allow using id or name for unifi_network data source

Add sample and update docs along

implements #174
This commit is contained in:
Tommi2Day
2021-09-07 20:41:44 +02:00
committed by Paul Tyng
parent 2acde28a53
commit cfc0f57622
4 changed files with 97 additions and 39 deletions

View File

@@ -3,47 +3,59 @@
page_title: "unifi_network Data Source - terraform-provider-unifi"
subcategory: ""
description: |-
unifi_network data source can be used to retrieve settings for a network by name.
unifi_network data source can be used to retrieve settings for a network by name or id.
---
# unifi_network (Data Source)
`unifi_network` data source can be used to retrieve settings for a network by name.
`unifi_network` data source can be used to retrieve settings for a network by name or id.
## Example Usage
```terraform
#retrieve network data by unifi network name
data "unifi_network" "byName" {
name="LAN"
}
#retrieve network data from user record
data "unifi_user" "byMac" {
mac = "01:23:45:67:89:ab"
}
data "unifi_network" "byID" {
id = data.unifi_user.byMac.network_id
}
```
<!-- schema generated by tfplugindocs -->
## Schema
### Required
- **name** (String) The name of the network.
### Optional
- **id** (String) The ID of the network. One of `id` OR `name` is required.
- **name** (String) The name of the network. One of `id` OR `name` is required.
- **site** (String) The name of the site to associate the network with.
### Read-Only
- **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.
- **dhcp_dns** (List of String) IPv4 addresses for the DNS server to be returned from the DHCP server.
- **dhcp_enabled** (Boolean) whether DHCP is enabled or not on this network.
- **dhcp_lease** (Number) lease time for DHCP addresses.
- **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.
- **dhcpd_boot_enabled** (Boolean) Toggles on the DHCP boot options. Should be set to true when you want to have dhcpd_boot_filename, and dhcpd_boot_server to take effect.
- **dhcpd_boot_filename** (String) Specifies the file to PXE boot from on the dhcpd_boot_server.
- **dhcpd_boot_server** (String) Specifies the IPv4 address of a TFTP server to network boot from.
- **dhcpd_boot_enabled** (Boolean) Toggles on the DHCP boot options. will be set to true if you have dhcpd_boot_filename, and dhcpd_boot_server set.
- **dhcpd_boot_filename** (String) the file to PXE boot from on the dhcpd_boot_server.
- **dhcpd_boot_server** (String) IPv4 address of a TFTP server to network boot from.
- **domain_name** (String) The domain name of this network.
- **id** (String) The ID of the network.
- **igmp_snooping** (Boolean) Specifies whether IGMP snooping is enabled or not.
- **ipv6_interface_type** (String) Specifies which type of IPv6 connection to use.
- **ipv6_pd_interface** (String) Specifies which WAN interface to use for IPv6 PD.
- **ipv6_pd_interface** (String) Specifies which WAN interface is used for IPv6 Prefix Delegation.
- **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'.
- **ipv6_static_subnet** (String) Specifies the static IPv6 subnet (when ipv6_interface_type is 'static').
- **network_group** (String) The group of the network.
- **purpose** (String) The purpose of the network. One of `corporate`, `guest`, `wan`, or `vlan-only`.
- **subnet** (String) The subnet of the network. Must be a valid CIDR address.
- **subnet** (String) The subnet of the network (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.