Skip to content

Commit

Permalink
fix: ipv6 addr-list addr w/o netmask adds /128 netmask #216
Browse files Browse the repository at this point in the history
Unlike with ipv4 address lists,
routeros will add a /128 netmask when an ip w/o netmask is given as input.
Add a DiffSuppressFunc to not have changing plans every run.
  • Loading branch information
dmaes committed May 19, 2023
1 parent 7d4a284 commit d6f7fad
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions routeros/resource_ipv6_firewall_addr_list.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package routeros

import (
"fmt"

"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
)

Expand All @@ -27,6 +29,17 @@ func ResourceIPv6FirewallAddrList() *schema.Resource {
Type: schema.TypeString,
Required: true,
Description: "A single IPv6 address or IPv6 CIDR subnet",
DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool {
if old == new {
return true
}

if old == "" || new == "" {
return false
}

return old == fmt.Sprintf("%s/128", new)
},
},
KeyComment: PropCommentRw,
"creation_time": {
Expand Down

0 comments on commit d6f7fad

Please sign in to comment.