Community Note
- Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
- Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
- If you are interested in working on this issue or have submitted a pull request, please leave a comment
Description
Subnets defined in-line within the Virtual Network resource doesn't support all parameters that are available in the standalone Subnet resource.
Subnets defined in-line within the Virtual Network resource support -->
- name
- address_prefix
- security_group
Subnet defined in the standalone Subnet resource support -->
- name
- resource_group_name
- virtual_network_name
- address_prefix
- network_security_group_id
- route_table_id
- service_endpoints
- delegation
- service_delegation
New or Affected Resource(s)
Potential Terraform Configuration
resource "azurerm_resource_group" "test" {
name = "acceptanceTestResourceGroup1"
location = "West US"
}
resource "azurerm_network_security_group" "test" {
name = "acceptanceTestSecurityGroup1"
location = "${azurerm_resource_group.test.location}"
resource_group_name = "${azurerm_resource_group.test.name}"
}
resource "azurerm_route_table" "test" {
name = "acceptanceTestRouteTable"
location = "${azurerm_resource_group.test.location}"
resource_group_name = "${azurerm_resource_group.test.name}"
disable_bgp_route_propagation = false
route {
name = "route1"
address_prefix = "10.1.0.0/16"
next_hop_type = "vnetlocal"
}
tags = {
environment = "Production"
}
}
resource "azurerm_ddos_protection_plan" "test" {
name = "ddospplan1"
location = "${azurerm_resource_group.test.location}"
resource_group_name = "${azurerm_resource_group.test.name}"
}
resource "azurerm_virtual_network" "test" {
name = "virtualNetwork1"
location = "${azurerm_resource_group.test.location}"
resource_group_name = "${azurerm_resource_group.test.name}"
address_space = ["10.0.0.0/16"]
dns_servers = ["10.0.0.4", "10.0.0.5"]
ddos_protection_plan {
id = "${azurerm_ddos_protection_plan.test.id}"
enable = true
}
subnet {
name = "subnet1"
address_prefix = "10.0.1.0/24"
route_table_id = azurerm_route_table.test.id
service_endpoints = ["Microsoft.Sql", "Microsoft.Storage"]
delegation {
name = "acctestdelegation"
service_delegation {
name = "Microsoft.ContainerInstance/containerGroups"
actions = ["Microsoft.Network/virtualNetworks/subnets/action"]
}
}
}
subnet {
name = "subnet2"
address_prefix = "10.0.2.0/24"
security_group = azurerm_network_security_group.test.id
}
tags = {
environment = "Production"
}
}
References
azurerm_subnet : https://www.terraform.io/docs/providers/azurerm/r/subnet.html
azurerm_virtual_network : https://www.terraform.io/docs/providers/azurerm/r/virtual_network.html
Community Note
Description
Subnets defined in-line within the Virtual Network resource doesn't support all parameters that are available in the standalone Subnet resource.
Subnets defined in-line within the Virtual Network resource support -->
Subnet defined in the standalone Subnet resource support -->
New or Affected Resource(s)
Potential Terraform Configuration
References
azurerm_subnet : https://www.terraform.io/docs/providers/azurerm/r/subnet.html
azurerm_virtual_network : https://www.terraform.io/docs/providers/azurerm/r/virtual_network.html