hashicorp / terraform-provider-azurerm

Terraform provider for Azure Resource Manager
https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs
Mozilla Public License 2.0
4.53k stars 4.61k forks source link

azurerm_storage_account: from where is 'allow_nested_items_to_be_public' comming? #27513

Open J0F3 opened 3 days ago

J0F3 commented 3 days ago

Is there an existing issue for this?

Community Note

Description

I like to understand why the property 'allow_nested_items_to_be_public' of a storage account is named this way.

In every other tooling this setting is called allowBlobPublicAccess. So why is it that different in azurem which is not even intuitive to find. What makes it even worse is that one would not find it by searching for "blob" in the documentation because not even the description is a hint to the actual setting in azure: " (Optional) Allow or disallow nested items within this Account to opt into being public."

In additional the default is exactly the opposite as it is actually in Azure. (Default in Azure is false where in azurerm it is true)

This all makes the setting very difficult to find. Especially when there is an Azure Policy which says you the storage account cannot be created because the setting allowBlobPublicAccess must be set to false but you cannot find it in Terraform azurerm.

Azure Portal: image

Azure CLI:

 az storage account create --allow-blob-public-access $false

ARM / Bicep:

  properties: {
    allowBlobPublicAccess: false
  ]

Azure PowserShell:

New-AzStorageAccount -AllowBlobPublicAccess

Terraform azurerm:

allow_nested_items_to_be_public = false

So, I think it would be worth considering if this cannot be changed to the actual name of the setting and to use the same default value as azure itself is using (false instead of true).

Thanks!

New or Affected Resource(s)/Data Source(s)

azurerm_storage_account

Potential Terraform Configuration

resource "azurerm_storage_account" "strg" {
  name                = "somestr"
  resource_group_name = azurerm_resource_group.rg.name
  location            = azurerm_resource_group.rg.location

  account_kind             = "StorageV2"
  account_tier             = "Standard"
  account_replication_type = "ZRS"

  allow_blob_public_access = false 
}

References

https://learn.microsoft.com/en-us/azure/storage/blobs/anonymous-read-access-configure

Chambras commented 3 days ago

@J0F3 I will take a look.