Skip to content

Commit

Permalink
Fix unintended plan diff from unspecified defaults
Browse files Browse the repository at this point in the history
The default value for `auto_mac` is false, and `lease_time` 30m, but if
unspecified they're assumed true and 10m respectively; so a plan with
them unspecified and having imported the default configuration from a
freshly reset routeros wants to change them.
  • Loading branch information
OJFord committed May 27, 2024
1 parent 6cb8569 commit 1d613c4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
1 change: 1 addition & 0 deletions routeros/resource_interface_bridge.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ func ResourceInterfaceBridge() *schema.Resource {
"auto_mac": {
Type: schema.TypeBool,
Optional: true,
Default: false,
Description: "Automatically select one MAC address of bridge ports as a bridge MAC address, bridge MAC " +
"will be chosen from the first added bridge port. After a device reboot, the bridge MAC " +
"can change depending on the port-number.",
Expand Down
16 changes: 8 additions & 8 deletions routeros/resource_ip_dhcp_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@ func ResourceDhcpServer() *schema.Resource {
"* lease-time - use time from lease-time parameter",
},
"bootp_support": {
Type: schema.TypeString,
Optional: true,
Default: "static",
Description: "Support for BOOTP clients.",
ValidateFunc: validation.StringInSlice([]string{"none", "static", "dynamic"}, false),
Type: schema.TypeString,
Optional: true,
DiffSuppressFunc: AlwaysPresentNotUserProvided,
Description: "Support for BOOTP clients.",
ValidateFunc: validation.StringInSlice([]string{"none", "static", "dynamic"}, false),
},
"client_mac_limit": {
Type: schema.TypeInt,
Expand Down Expand Up @@ -94,9 +94,9 @@ func ResourceDhcpServer() *schema.Resource {
Description: "A script that will be executed after a lease is assigned or de-assigned.",
},
"lease_time": {
Type: schema.TypeString,
Optional: true,
Default: "10m",
Type: schema.TypeString,
Optional: true,
DiffSuppressFunc: AlwaysPresentNotUserProvided,
Description: "The time that a client may use the assigned address. The client will try to renew this " +
"address after half of this time and will request a new address after the time limit expires.",
},
Expand Down

0 comments on commit 1d613c4

Please sign in to comment.