Bug unifi_network -> subnet always assume 1 as ip address
unifi_network->subnet always assume .1 ip address for the VLAN ip address.
Example configuration:
' resource "unifi_network" "vlan_devices" { name = "99_Devices" purpose = "corporate" vlan_id = var.vlan_id_devices subnet = "10.16.99.254/24" dhcp_start = "10.16.99.6" dhcp_stop = "10.16.99.253" dhcp_enabled = true wan_gateway = "0.0.0.0" igmp_snooping = true intra_network_access_enabled = false
lifecycle { ignore_changes = [ wan_gateway, ] } } '
This configuration ends always with the network IP Address 10.16.99.1 instead of applying 10.16.99.254.
When I re-run changing to .1 the state assumes no changes. When I get back to .254, it assumes again no changes.
I might be misunderstanding, but 10.16.99.254/24 isn't a valid cidr block?
subnet maps to the ip_network field in unifi which is an interface spec, so subnet = "10.16.99.254/24" means the network is 10.16.99.0/24 with the gateway listening on .254. I ran in to this exact same issue, with these settings in the UI:
I ran terraform import and modified the resource to match my live config, terraform plan showed no changes, and then it changed the gateway IP for the network to 10.254.0.1. The json response from the API has "ip_subnet": "10.254.128.1/16".
My PR fixes this issue:
https://github.com/paultyng/terraform-provider-unifi/pull/454