Files
terraform-provider-unifi/docs/resources/network.md
2021-03-21 16:47:22 -04:00

3.5 KiB

page_title, subcategory, description
page_title subcategory description
unifi_network Resource - terraform-provider-unifi unifi_network manages WAN/LAN/VLAN networks.

unifi_network (Resource)

unifi_network manages WAN/LAN/VLAN networks.

Example Usage

variable "vlan_id" {
  default = 10
}

resource "unifi_network" "vlan" {
  name    = "wifi-vlan"
  purpose = "corporate"

  subnet       = "10.0.0.1/24"
  vlan_id      = var.vlan_id
  dhcp_start   = "10.0.0.6"
  dhcp_stop    = "10.0.0.254"
  dhcp_enabled = true
}

resource "unifi_network" "wan" {
  name    = "wan"
  purpose = "wan"

  wan_networkgroup = "WAN"
  wan_type         = "pppoe"
  wan_ip           = "192.168.1.1"
  wan_egress_qos   = 1
  wan_username     = "username"
  x_wan_password   = "password"
}

Schema

Required

  • name (String) The name of the network.
  • purpose (String) The purpose of the network. Must be one of corporate, guest, wan, or vlan-only.

Optional

  • dhcp_dns (List of String) Specifies the IPv4 addresses for the DNS server to be returned from the DHCP server. Leave blank to disable this feature.
  • dhcp_enabled (Boolean) Specifies whether DHCP is enabled or not on this network.
  • dhcp_lease (Number) Specifies the lease time for DHCP addresses. Defaults to 86400.
  • dhcp_start (String) The IPv4 address where the DHCP range of addresses starts.
  • dhcp_stop (String) The IPv4 address where the DHCP range of addresses stops.
  • domain_name (String) The domain name of this network.
  • igmp_snooping (Boolean) Specifies whether IGMP snooping is enabled or not.
  • ipv6_interface_type (String) Specifies which type of IPv6 connection to use. Defaults to none.
  • ipv6_pd_interface (String) Specifies which WAN interface to use for IPv6 PD.
  • ipv6_pd_prefixid (String) Specifies the IPv6 Prefix ID.
  • ipv6_ra_enable (Boolean) Specifies whether to enable router advertisements or not.
  • ipv6_static_subnet (String) Specifies the static IPv6 subnet when ipv6_interface_type is 'static'.
  • network_group (String) The group of the network. Defaults to LAN.
  • site (String) The name of the site to associate the network with.
  • subnet (String) The subnet of the network. Must be a valid CIDR address.
  • vlan_id (Number) The VLAN ID of the network.
  • wan_dns (List of String) DNS servers IPs of the WAN.
  • wan_egress_qos (Number) Specifies the WAN egress quality of service. Defaults to 0.
  • wan_gateway (String) The IPv4 gateway of the WAN.
  • wan_ip (String) The IPv4 address of the WAN.
  • wan_netmask (String) The IPv4 netmask of the WAN.
  • wan_networkgroup (String) Specifies the WAN network group. Must be one of either WAN, WAN2 or WAN_LTE_FAILOVER.
  • wan_type (String) Specifies the IPV4 WAN connection type. Must be one of either disabled, static, dhcp, or pppoe.
  • wan_username (String) Specifies the IPV4 WAN username.
  • x_wan_password (String) Specifies the IPV4 WAN password.

Read-Only

  • id (String) The ID of the network.

Import

Import is supported using the following syntax:

# import from provider configured site
terraform import unifi_network.mynetwork 5dc28e5e9106d105bdc87217

# import from another site
terraform import unifi_network.mynetwork bfa2l6i7:5dc28e5e9106d105bdc87217

# import network by name
terraform import unifi_network.mynetwork name=LAN