Skip to content

Commit

Permalink
fix: IP address not updating when dns_name removed
Browse files Browse the repository at this point in the history
  • Loading branch information
smutel committed Nov 25, 2020
1 parent c38976c commit c4cd536
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions netbox/resource_netbox_ipam_ip_addresses.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func resourceNetboxIpamIPAddresses() *schema.Resource {
"dns_name": {
Type: schema.TypeString,
Optional: true,
Default: "",
Default: " ",
ValidateFunc: validation.StringMatch(
regexp.MustCompile("^[-a-zA-Z0-9_.]{1,255}$"),
"Must be like ^[-a-zA-Z0-9_.]{1,255}$"),
Expand Down Expand Up @@ -215,7 +215,14 @@ func resourceNetboxIpamIPAddressesRead(d *schema.ResourceData,
return err
}

if err = d.Set("dns_name", resource.DNSName); err != nil {
var dnsName string
if resource.DNSName == "" {
dnsName = " "
} else {
dnsName = resource.DNSName
}

if err = d.Set("dns_name", dnsName); err != nil {
return err
}

Expand Down

0 comments on commit c4cd536

Please sign in to comment.