Skip to main content

dtcloud_routers (Data Source)

Lists every router visible to the caller.

Example Usage​

data "dtcloud_routers" "all" {}

data "dtcloud_routers" "edge" {
name = "edge"
}

# enable_snat also reads false on a router with no gateway at all, so is_external
# is what tells the two apart.
output "routers_without_a_gateway" {
value = [for r in data.dtcloud_routers.all.routers : r.name if !r.is_external]
}

Schema​

Optional​

  • name (String) Only return routers with this exact name. Applied by the provider.
  • status (String) Only return routers in this status, e.g. ACTIVE. Applied by the provider.

Read-Only​

  • id (String) The ID of this resource.
  • routers (List of Object) The routers that matched, in the order the platform returned them. (see below for nested schema)

Nested Schema for routers​

Read-Only:

  • cidr (String)
  • enable_snat (Boolean)
  • external_network (String)
  • id (String)
  • is_external (Boolean)
  • name (String)
  • status (String)

Behaviour worth knowing​

  • Both filters are applied by the provider, after the full list has been fetched, because the endpoint takes no query parameters.
  • enable_snat reads false for a router with no gateway at all, so on its own it does not tell "SNAT off" from "no gateway". is_external does.
  • The external network is a name here and an id on dtcloud_router. This endpoint is not given the id. If you need it -- to build a matching dtcloud_router, for instance -- look the router up by id with dtcloud_router, or look the name up in dtcloud_networks.