Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Fix empty value check to handle default numeric values correctly #286

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/resources/interface_eoip.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ resource "routeros_interface_eoip" "eoip_tunnel1" {
- `loop_protect_send_interval` (String)
- `mtu` (String) Layer3 Maximum transmission unit ('auto', 0 .. 65535)
- `remote_address` (String) IP address of the remote end of the tunnel.
- `tunnel_id` (String) Unique tunnel identifier, which must match the other side of the tunnel.
- `tunnel_id` (Number) Unique tunnel identifier, which must match the other side of the tunnel.

### Read-Only

Expand Down
2 changes: 1 addition & 1 deletion routeros/mikrotik_serialize.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func isEmpty(propName string, schemaProp *schema.Schema, d *schema.ResourceData,
}
return v.(string) == "" && confValue.IsNull()
case schema.TypeInt:
return !d.HasChange(propName)
return confValue.IsNull() && schemaProp.Default == nil
case schema.TypeBool:
// If true, it is always not empty:
if v.(bool) {
Expand Down
4 changes: 2 additions & 2 deletions routeros/resource_interface_eoip.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ func ResourceInterfaceEoip() *schema.Resource {
KeyRemoteAddress: PropRemoteAddressRw,
KeyRunning: PropRunningRo,
"tunnel_id": {
Type: schema.TypeString,
Type: schema.TypeInt,
Optional: true,
Default: "0",
Default: 0,
Description: "Unique tunnel identifier, which must match the other side of the tunnel.",
},
}
Expand Down
Loading