|
| 1 | +# Terraform Azure Container Registry - Advanced Example |
| 2 | + |
| 3 | +This example demonstrates a **full-featured deployment** of an Azure Container Registry (ACR) using the module. |
| 4 | + |
| 5 | +It is suitable for **production environments** where: |
| 6 | + |
| 7 | +- High availability and security are required |
| 8 | +- Georeplication across regions is needed |
| 9 | +- Managed identities and customer-managed encryption are used |
| 10 | +- Network access is restricted with custom rules |
| 11 | +- Quarantine and trust policies are enabled |
| 12 | + |
| 13 | +```hcl |
| 14 | +module "acr_advanced" { |
| 15 | + source = "./terraform-azure-container-registry" |
| 16 | + acr_name = "myadvancedacr" |
| 17 | + resource_group_name = "rg-prod" |
| 18 | + resource_group_location = "West Europe" |
| 19 | + acr_tier = "Premium" |
| 20 | + acr_admin_enabled = false |
| 21 | + public_network_access_enabled = false |
| 22 | + quarantine_policy_enabled = true |
| 23 | + zone_redundancy_enabled = true |
| 24 | + export_policy_enabled = true |
| 25 | + anonymous_pull_enabled = false |
| 26 | + data_endpoint_enabled = true |
| 27 | + network_rule_bypass_option = "None" |
| 28 | + retention_policy = 30 |
| 29 | + trust_policy = { enabled = true } |
| 30 | +
|
| 31 | + georeplications = [ |
| 32 | + { |
| 33 | + location = "North Europe" |
| 34 | + zone_redundancy_enabled = true |
| 35 | + regional_endpoint_enabled = true |
| 36 | + tags = { |
| 37 | + replication = "north" |
| 38 | + } |
| 39 | + }, |
| 40 | + { |
| 41 | + location = "East US" |
| 42 | + zone_redundancy_enabled = false |
| 43 | + regional_endpoint_enabled = true |
| 44 | + tags = { |
| 45 | + replication = "east" |
| 46 | + } |
| 47 | + } |
| 48 | + ] |
| 49 | +
|
| 50 | + network_rule_set = { |
| 51 | + default_action = "Deny" |
| 52 | + ip_rules = ["203.0.113.0/24", "198.51.100.0/24"] |
| 53 | + } |
| 54 | +
|
| 55 | + identity = { |
| 56 | + type = "UserAssigned" |
| 57 | + identity_ids = ["/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg-prod/providers/Microsoft.ManagedIdentity/userAssignedIdentities/mi-acr"] |
| 58 | + } |
| 59 | +
|
| 60 | + encryption = { |
| 61 | + key_vault_key_id = "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg-prod/providers/Microsoft.KeyVault/vaults/myvault/keys/mykey" |
| 62 | + identity_client_id = "00000000-0000-0000-0000-000000000000" |
| 63 | + } |
| 64 | +
|
| 65 | + default_tags = { |
| 66 | + environment = "prod" |
| 67 | + project = "example" |
| 68 | + } |
| 69 | +} |
| 70 | +``` |
0 commit comments