» Data Source: azurerm_subnet

Use this data source to access information about an existing Subnet within a Virtual Network.

» Example Usage

data "azurerm_subnet" "example" {
  name                 = "backend"
  virtual_network_name = "production"
  resource_group_name  = "networking"

output "subnet_id" {
  value = data.azurerm_subnet.example.id

» Argument Reference

  • name - Specifies the name of the Subnet.
  • virtual_network_name - Specifies the name of the Virtual Network this Subnet is located within.
  • resource_group_name - Specifies the name of the resource group the Virtual Network is located in.

» Attributes Reference

» Timeouts

The timeouts block allows you to specify timeouts for certain actions:

  • read - (Defaults to 5 minutes) Used when retrieving the Subnet located within a Virtual Network.