Manages an Immutability Policy for a Container within an Azure Storage Account.
resource "azurerm_resource_group" "example" {
name = "example-resources"
location = "West Europe"
}
resource "azurerm_storage_account" "example" {
name = "examplestoraccount"
resource_group_name = azurerm_resource_group.example.name
location = azurerm_resource_group.example.location
account_tier = "Standard"
account_replication_type = "LRS"
tags = {
environment = "staging"
}
}
resource "azurerm_storage_container" "example" {
name = "example"
storage_account_name = azurerm_storage_account.example.name
container_access_type = "private"
}
resource "azurerm_storage_container_immutability_policy" "example" {
storage_container_resource_manager_id = azurerm_storage_container.example.resource_manager_id
immutability_period_in_days = 14
protected_append_writes_all_enabled = false
protected_append_writes_enabled = true
}
The following arguments are supported:
storage_container_resource_manager_id
- (Required) The Resource Manager ID of the Storage Container where this Immutability Policy should be applied. Changing this forces a new resource to be created.
immutability_period_in_days
- (Required) The time interval in days that the data needs to be kept in a non-erasable and non-modifiable state.
locked
- (Optional) Whether to lock this immutability policy. Cannot be set to false
once the policy has been locked.
protected_append_writes_all_enabled
- (Optional) Whether to allow protected append writes to block and append blobs to the container. Defaults to false
. Cannot be set with protected_append_writes_enabled
.
protected_append_writes_enabled
- (Optional) Whether to allow protected append writes to append blobs to the container. Defaults to false
. Cannot be set with protected_append_writes_all_enabled
.
No additional attributes are exported.
The timeouts
block allows you to specify timeouts for certain actions:
create
- (Defaults to 10 minutes) Used when creating the Storage Container Immutability Policy.update
- (Defaults to 10 minutes) Used when updating the Storage Container Immutability Policy.read
- (Defaults to 5 minutes) Used when retrieving the Storage Container Immutability Policy.delete
- (Defaults to 10 minutes) Used when deleting the Storage Container Immutability Policy.Storage Container Immutability Policies can be imported using the resource id
, e.g.
terraform import azurerm_storage_container_immutability_policy.example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myresourcegroup/providers/Microsoft.Storage/storageAccounts/myaccount/blobServices/default/containers/mycontainer/immutabilityPolicies/default