Terraform azure storage account how to enable container soft delete

Hello,

On a storage account “container soft delete” can be enable. (enable soft delete for containers)

I have found the following terraform information:
https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/storage_account#blob_properties

versioning_enabled = true
change_feed_enabled = true
container_delete_retention_policy {
days = 150
}

I don’t see a way to enable the container soft delete checkbox? How can this be accomplished?

Thanks in advance!

1 Like

Did you find how to do it?

I ran into the same question, but I found out that just by setting the retention period, the checkboxes got checked. In my case, I added the below retention block to the storage account and both checkboxes (for blob and container) got set, including the period as specified.

blob_properties {
delete_retention_policy {
days = 365
}
container_delete_retention_policy {
days = 7
}
}

1 Like