Use this data source to access the properties of an Azure Subnet located within a Virtual Network.
data "azurerm_subnet" "test" {
name = "backend"
virtual_network_name = "production"
resource_group_name = "networking"
}
output "subnet_id" {
value = "${data.azurerm_subnet.test.id}"
}
name - (Required) Specifies the name of the Subnet. virtual_network_name - (Required) Specifies the name of the Virtual Network this Subnet is located within. resource_group_name - (Required) Specifies the name of the resource group the Virtual Network is located in. id - The ID of the Subnet. address_prefix - The address prefix used for the subnet. network_security_group_id - The ID of the Network Security Group associated with the subnet. route_table_id - The ID of the Route Table associated with this subnet. ip_configurations - The collection of IP Configurations with IPs within this subnet.
© 2018 HashiCorpLicensed under the MPL 2.0 License.
https://www.terraform.io/docs/providers/azurerm/d/subnet.html