dtcloud_router_interfaces (Data Source)
Lists everything attached to a router: the external gateway and the internal interfaces, in one list.
The list is as the platform returns it, external gateway first, and includes interfaces Terraform does not manage.
Example Usage
data "dtcloud_router_interfaces" "edge" {
router_id = dtcloud_router.main.id
}
# The port ids dtcloud_router_interface can be imported with. Check `type` first:
# the endpoint puts a subnet id in `id` for the external gateway.
output "internal_port_ids" {
value = [
for i in data.dtcloud_router_interfaces.edge.interfaces :
i.id if i.type == "Internal interface"
]
}
Schema
Required
router_id(String) ID of the router whose interfaces are listed.
Read-Only
id(String) The ID of this resource.interfaces(List of Object) The router's interfaces, external gateway first. (see below for nested schema)
Nested Schema for interfaces
Read-Only:
cidr(String)id(String)ip_address(String)network_id(String)network_name(String)status(String)subnet_id(String)type(String)
Behaviour worth knowing
danger
id means two different things. The endpoint puts a port id there for an internal
interface and a subnet id for the external gateway, and there is no way to make it mean one.
Check type first: only an internal interface's id is something dtcloud_router_interface can be
imported with or detached by.
network_idandsubnet_idare not reported for the external gateway.