Hey i am currently using Terraform v0.12.28 and provider azurerm v2.22.0 i wanted to Disable (Allow Shared Access Key, Allow Blob public access, and use TLS1_2) in Azure Storage Configuration to make it secure, i found "allow_blob_public_access = false" and "min_tls_version = "TLS1_2" but unable to find parameter to disable Allow Shared Access Key.
resource "azurerm_storage_account" "main" {
name = var.storage_account_name
resource_group_name = azurerm_resource_group.main.name
location = azurerm_resource_group.main.location
account_tier = var.account_tier
account_replication_type = var.account_replication_type
allow_blob_public_access = false
min_tls_version = "TLS1_2"
}
There is no option to set the Allow Shared Access Key in Terraform, it simply means Terraform does not support this feature and this feature in Azure is also the preview version. There is another way to set the Allow Shared Access Key beside the Azure portal.
This way is to use the Azure CLI through the local-exec
in Terraform:
resource "null_resource" "example" {
provisioner "local-exec" {
command = "az resource update --ids ${azurerm_storage_account.main.id} --set properties.allowSharedKeyAccess=false"
}
}
You can get more details about Allow Shared Access Key here.