You could use the AzAPI provider:
softDeletePolicy = {
retentionDays = int
status = "string"
}
First, run az acr show -g <your-resource-group> -n <your-acr-name> -o json to get the container registry's resource configuration in JSON format.
Then, construct an azapi_resource in your Terraform configuration using the relevant bits of the JSON:
resource "azapi_resource" "your_acr" {
type = "Microsoft.ContainerRegistry/registries@2023-11-01-preview"
name = "youracr"
location = "westus"
parent_id = azurerm_resource_group.your_resource_group.id
tags = { }
body = jsonencode({
properties = {
adminUserEnabled = false
...
Next, import the AzAPI resource into your Terraform configuration:
terraform import azapi_resource.your_acr /subscriptions/<your-subscription-id>/resourcegroups/<your-resource-group-name>/providers/Microsoft.ContainerRegistry/registries/youracr
Update the AzAPI resource in the Terraform config to set soft delete policy:
softDeletePolicy = {
retentionDays = 7
status = "enabled"
}
Finally, apply the change via terraform apply