Skip to content

Commit

Permalink
fix: Fix empty value check to handle default numeric values correctly (
Browse files Browse the repository at this point in the history
  • Loading branch information
dokmic authored Nov 2, 2023
1 parent 678c9a4 commit 661e49c
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
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

0 comments on commit 661e49c

Please sign in to comment.