-
Notifications
You must be signed in to change notification settings - Fork 4.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
azurerm_subnet
: Support for multiple prefixes with address_prefixes
#6493
azurerm_subnet
: Support for multiple prefixes with address_prefixes
#6493
Conversation
@mbfrahry PTAL |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @fabianofranz, so the tests panic when using address_prefixes
TestAccDataSourceAzureRMSubnet_basic_addressPrefixes
panic: interface conversion: interface {} is nil, not string
goroutine 529 [running]:
github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/network.resourceAzureSubnetHash(0x4aca700, 0xc0016d8600, 0xc0009c9210)
/Users/mbfrahry/workspace/gocode/src/github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/network/resource_arm_virtual_network.go:445 +0x276
This is because we're assuming address_space
is being set in the Hash for subnets under virtual networks. We'll just need to confirm that that value is ok before setting it. It'll be just like security_group
a couple lines below this line https://github.com/terraform-providers/terraform-provider-azurerm/blob/master/azurerm/internal/services/network/resource_arm_virtual_network.go#L445
The azure subnet resource supports addressPrefix when one prefix is available and addressPrefixes when two or or more are set (for instance, when configuring an ipv4 and ipv6 dual stack configuration for a network). Update azurerm_subnet to allow either address_prefix or address_prefixes as input, where the latter is a list of string. Check that at least one is set, and mark the older address_prefix as deprecated. The data source for subnet is modified to always return address_prefixes to simplify retrieval (although this could be changed to always return the first address prefix as address_prefix). Today, if two prefixes are specified via CLI or Azure UI the data source returns no address_prefix and it is not possible to create a new subnet with two prefixes via Terraform. Fixes #5140
@mbfrahry oops, my bad, thanks for pointing out. Fixed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
azurerm_subnet
: Support for multiple prefixes with address_prefixes
This has been released in version 2.8.0 of the provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. As an example: provider "azurerm" {
version = "~> 2.8.0"
}
# ... other configuration ... |
* Update Azure subnet `address_prefix` to `azure_prefixes` list * Fix warning that `address_prefix` is deprecated * Require `terraform-provider-azurerm` v2.8.0+ (action required) Rel: hashicorp/terraform-provider-azurerm#6493
* Update Azure subnet `address_prefix` to `azure_prefixes` list * Fix warning that `address_prefix` is deprecated * Require `terraform-provider-azurerm` v2.8.0+ (action required) Rel: hashicorp/terraform-provider-azurerm#6493
* Update Azure subnet `address_prefix` to `azure_prefixes` list * Fix warning that `address_prefix` is deprecated * Require `terraform-provider-azurerm` v2.8.0+ (action required) Rel: hashicorp/terraform-provider-azurerm#6493
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 [email protected]. Thanks! |
Splitting #6148 into separate PR's
The azure subnet resource supports addressPrefix when one prefix is available and addressPrefixes when two or or more are set (for instance, when configuring an ipv4 and ipv6 dual stack configuration for a network). Update azurerm_subnet to allow either address_prefix or address_prefixes as input, where the latter is a list of string. Check that at least one is set, and mark the older address_prefix as deprecated.
The data source for subnet is modified to always return address_prefixes to simplify retrieval (although this could be changed to always return the first address prefix as address_prefix).
Today, if two prefixes are specified via CLI or Azure UI the data source returns no address_prefix and it is not possible to create a new subnet with two prefixes via Terraform.
Fixes #5140