Skip to main content

dtcloud_network (Data Source)

Looks up one network by id.

Use it to reference a network Terraform did not create, which is the common case, since networks tend to outlive the things attached to them. Declaring one as a resource instead would hand Terraform ownership of it, and a later terraform destroy would take it down with everything else.

Example Usage​

data "dtcloud_network" "app" {
id = var.network_id
}

Schema​

Required​

  • id (String) ID of the network to look up.

Read-Only​

  • allocation_pools (List of Object) Address ranges the subnet allocates from. (see below for nested schema)
  • cidr (String) Address range of the subnet.
  • dns_nameservers (List of String) DNS servers advertised on this network.
  • enable_dhcp (Boolean) Whether the subnet hands out addresses over DHCP.
  • gateway_ip (String) Gateway address of the subnet.
  • ip_version (Number) IP version of the subnet.
  • ipam_enabled (Boolean) Whether the platform manages addressing, i.e. whether there is a subnet.
  • name (String) Name of the network.
  • network_type (String) Virtual or Physical.
  • subnet_id (String) ID of the subnet, empty when IPAM is off.

Nested Schema for allocation_pools​

Read-Only:

  • end (String)
  • start (String)

Behaviour worth knowing​

warning

A network with IPAM off has no subnet, so subnet_id, cidr, gateway_ip, enable_dhcp, ip_version, dns_nameservers and allocation_pools are empty. Check ipam_enabled before relying on them.

  • A network that does not exist is an error, not an empty result.