Setting my outputs on the root module to this works.
output "routes" {
value = [for route in azurerm_route.routes : route.name]
description = "Blocks containing configuration of each route."
}
I can then as @marko-e suggested reference this from my child module using
output "routes" {
value = module.route_table.routes
description = "Blocks containing configuration of each route."
}
The output now looks like this:
Outputs:
id = "/subscriptions/e286703f-8ba4-4a0d-bd44-8fb115bdebcd/resourceGroups/rg-rtb-uks-001/providers/Microsoft.Network/routeTables/route-table-001"
name = "route-table-001"
routes = [
"firewall",
"internet",
"route2",
]
Thanks.