Create a azurerm_storage_account_network_rules resource so they can be managed separately from the azurerm_storage_account resource.
resource "azurerm_storage_account_network_rules" "network_rules" {
name = "network_rules
storage_account = "${azurerm_storage_account.storage_account.id}"
bypass = "None"
ip_rules = "${var.myip}"
virtual_network_subnet_ids = ["${var.my_vnet_list}"]
}
we were looking into this (or similar) recently at work -- is what this is proposing effectively different than https://www.terraform.io/docs/providers/azurerm/r/storage_account.html#network_rules ?
I'm proposing a separate resource if possible. Similar to the way it works with azurerm_sql_firewall_rule. I've got a customer that would like to manage the network_rules outside of the storage_account resource. There's not a separate API for network_rules like there is for the sql firewall rules though.... so I'm hoping there's another way to make it work.
This functionality is very much needed, thanks for reporting and opening up a PR @MattMencel.
See #4186 for an example of why this is needed. Currently, a storage account can't be created that allows access from the IPs from a Function App without creating a circular reference that Terraform can't resolve. Something similar would happen with any resource that can't be attached to a specific pre-existing virtual network or IP resource.
Not sure if this affects your work but please take note of:
https://github.com/terraform-providers/terraform-provider-azurerm/issues/4574
Just a FYI
Fixed via #5082
This has been released in version 1.38.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 = "~> 1.38.0"
}
# ... other configuration ...
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!
Most helpful comment
I'm proposing a separate resource if possible. Similar to the way it works with
azurerm_sql_firewall_rule. I've got a customer that would like to manage the network_rules outside of the storage_account resource. There's not a separate API fornetwork_ruleslike there is for the sql firewall rules though.... so I'm hoping there's another way to make it work.