paultyng/terraform-provider-unifi

Add support for IPv6

martijngonlag opened this issue · 2 comments

@paultyng First of all, thank you very much for all your work on maintaining this provider. I recently acquired some Ubiquiti hardware and figured I use this as an excuse to brush up my Terraform skills. So far I've gotten things working for the most part but I've run into a few issues, one of which is the inability to set up IPv6 with the unifi_network resource. I suspect it's because one of the parameters to specify the IPv6 DNS servers is not currently supported.

My Setup

  1. UDM-Pro w/ 1 Switch and 2 APs w/ 1 Beacon
  2. Deploying the following via Terraform (so far):
    • WAN (Connected to ATT Fiber)
    • LAN (Private, Guest, IoT, Media, Work)
    • WiFi (Private, Guest, IoT, Work)
    • DDNS (Cloudflare)

Description of Issue
The unifi_network resource has the parameter ipv6_interface_type. When this is set to pd and you run terraform apply the API will return a 400 Bad Request because of InvalidIpv6Addr

Logs

│ Error: api.err.InvalidIpv6Addr (400 Bad Request) for PUT https://192.168.1.1/proxy/network/api/s/default/rest/networkconf/61e9f18c06e237062dd3ca31
│
│   with module.unifi_deployment.unifi_network.LAN["Guest"],
│   on ../../modules/network/unifi.tf line 33, in resource "unifi_network" "LAN":
│   33: resource "unifi_network" "LAN" {
│
╵
╷
│ Error: api.err.InvalidIpv6Addr (400 Bad Request) for PUT https://192.168.1.1/proxy/network/api/s/default/rest/networkconf/61e9f18d06e237062dd3ca35
│
│   with module.unifi_deployment.unifi_network.LAN["Work"],
│   on ../../modules/network/unifi.tf line 33, in resource "unifi_network" "LAN":
│   33: resource "unifi_network" "LAN" {
│
╵
╷
│ Error: api.err.InvalidIpv6Addr (400 Bad Request) for PUT https://192.168.1.1/proxy/network/api/s/default/rest/networkconf/61e9f18d06e237062dd3ca33
│
│   with module.unifi_deployment.unifi_network.LAN["Media"],
│   on ../../modules/network/unifi.tf line 33, in resource "unifi_network" "LAN":
│   33: resource "unifi_network" "LAN" {
│
╵
╷
│ Error: api.err.InvalidIpv6Addr (400 Bad Request) for POST https://192.168.1.1/proxy/network/api/s/default/rest/networkconf
│
│   with module.unifi_deployment.unifi_network.LAN["Private"],
│   on ../../modules/network/unifi.tf line 33, in resource "unifi_network" "LAN":
│   33: resource "unifi_network" "LAN" {
│
╵
╷
│ Error: api.err.InvalidIpv6Addr (400 Bad Request) for PUT https://192.168.1.1/proxy/network/api/s/default/rest/networkconf/61e9f18b06e237062dd3ca2f
│
│   with module.unifi_deployment.unifi_network.LAN["IoT"],
│   on ../../modules/network/unifi.tf line 33, in resource "unifi_network" "LAN":
│   33: resource "unifi_network" "LAN" {

My Resource

resource "unifi_network" "LAN" {
    for_each                    = var.networks
    purpose                     = each.value.purpose
    site                        = each.value.site
    domain_name                 = each.value.domain_name
    name                        = each.value.lan_name
    subnet                      = each.value.subnet
    vlan_id                     = each.value.vlan_id
    dhcp_start                  = each.value.dhcp_start
    dhcp_stop                   = each.value.dhcp_stop
    dhcp_enabled                = each.value.dhcp_enabled
    dhcp_lease                  = each.value.dhcp_lease
    dhcp_relay_enabled          = each.value.dhcp_relay_enabled
    dhcpd_boot_enabled          = each.value.dhcpd_boot_enabled
    dhcp_dns                    = each.value.dhcp_dns
    igmp_snooping               = each.value.igmp_snooping
    ipv6_ra_enable              = each.value.ipv6_ra_enable
    ipv6_pd_interface           = each.value.ipv6_pd_interface
    ipv6_interface_type         = each.value.ipv6_interface_type
    wan_egress_qos              = each.value.wan_egress_qos
    wan_networkgroup            = each.value.wan_networkgroup
    wan_type                    = each.value.wan_type
    wan_gateway                 = each.value.wan_gateway
}

IPV6 RA is broken on att fiber's modem. it will tell you its giving your router a /56 but its actually giving you a /64 so you cant create subnets

IPV6 RA is broken on att fiber's modem. it will tell you its giving your router a /56 but its actually giving you a /64 so you cant create subnets

Thanks for the response, though I am not entirely sure if this is related. Without Terraform I have IPv6 working on this deployment. It seem much more like one of the required parameters isn't covered?