I want to retrieve/pull the subnet IDs from an existing VNET in Azure using the azurerm_virtual_network data source. My code below is not working as expected. Any help is appreciated.
data "azurerm_virtual_network" "vnet" {
name = "my-vnet"
resource_group_name = "my-resource-group"
}
output "my-subnets-ids" {
value = "${data.azurerm_virtual_network.vnet.subnets.id}"
}
I am receiving the following error when I execute.
output.my-subnets: Resource 'data.azurerm_virtual_network.vnet'
does not have attribute 'subnets.id' for variable
'data.azurerm_virtual_network.vnet.subnets.id'