-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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_storage_account_network_rules not clearing out ip_rules nor virtual_network_subnet_ids #7357
Comments
This has been released in version 2.16.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.16.0"
}
# ... other configuration ... |
…urerm_storage_account_network_rules` (hashicorp#7385) fix hashicorp#7357 "getOk" will ignore the zero value, and the rules will always contain last value we could directly get the vaules and pass them
…urerm_storage_account_network_rules` (hashicorp#7385) fix hashicorp#7357 "getOk" will ignore the zero value, and the rules will always contain last value we could directly get the vaules and pass them
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! |
Community Note
Terraform (and AzureRM Provider) Version
Affected Resource(s)
azurerm_storage_account_network_rules
Terraform Configuration Files
Debug Output
1st apply (gist).
2nd apply (gist).
Panic Output
Not applicable.
Expected Behavior
Terraform should clear out both
ip_range
as well asvirtual_network_subnet_ids
whenever it is given empty array's.Actual Behavior
Terraform does not clear out
ip_range
norvirtual_network_subnet_ids
whenever it is given empty array's. Going from a list of 2 IP items or 2 subnet items to 1 works fine, the problem only occurs when either of the lists need to be cleared out entirely. You can see the erroneous updates (still including items) in the 2nd apply (gist).Steps to Reproduce
terraform apply
the configuration as above.azurerm_storage_account_network_rules.example.ip_ranges
andazurerm_storage_account_network_rules.example.virtual_network_subnet_ids
to[]
.terraform apply
again, and observe that Terraform is planning to clear out bothip_range
andvirtual_network_subnet_ids
.portal.azure.com
and navigate to the Firewall section of the Storage Account. Both IP and Subnet are still present. You can also repeat step 3. and observe that Terraform is again detecting it needs to change both attributes.Important Factoids
References
Not applicable.
Context
To provide some context as to how I encountered this problem and why I need this to work properly. We're using a bunch of storage accounts in conjunction with an AKS cluster. We generally lock down every SA with Firewall so that only the AKS subnet can access these storage accounts. Occasionally it happens that Developers need direct access to a Storage Account (for debugging purposes), so we just manually add the IP's and go in. We usually relied on frequent TF applies (which run with CI/CD pipelines) to clear out these residual IPs that keep floating around even after the Developers are done debugging. This previously worked fine when we used to define the network rules directly inside the
azurerm_storage_account
block itself, but we recently moved to the newer resourceazurerm_storage_account_network_rules
(keeping in mind to only define rules here and not in the SA block anymore) , and thats when I started noticing this issue.The text was updated successfully, but these errors were encountered: