File tree Expand file tree Collapse file tree 1 file changed +8
-22
lines changed
infra/modules/providers/azure/container-registry Expand file tree Collapse file tree 1 file changed +8
-22
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ data "azurerm_resource_group" "container_registry" {
44
55data "azurerm_client_config" "current" {}
66
7+
78resource "azurerm_container_registry" "container_registry" {
89 name = var. container_registry_name
910 resource_group_name = data. azurerm_resource_group . container_registry . name
@@ -29,29 +30,14 @@ resource "azurerm_container_registry" "container_registry" {
2930 ip_range = ip_rule. value
3031 }
3132 }
33+ dynamic "virtual_network" {
34+ for_each = var. subnet_id_whitelist
35+ content {
36+ action = " Allow"
37+ subnet_id = virtual_network. value
38+ }
39+ }
3240 }
3341 }
34- }
3542
36- # Configures access from the subnets that should have access
37- resource "null_resource" "acr_acr_subnet_access_rule" {
38- count = length (var. subnet_id_whitelist )
39- triggers = {
40- acr_id = azurerm_container_registry.container_registry.id
41- subnets = join (" ," , var. subnet_id_whitelist )
42- }
43- provisioner "local-exec" {
44- command = << EOF
45- az acr network-rule add \
46- --subscription "$SUBSCRIPTION_ID" \
47- --resource-group "$RESOURCE_GROUP_NAME" \
48- --name ${ var . container_registry_name } \
49- --subnet ${ var . subnet_id_whitelist [count . index ]}
50- EOF
51-
52- environment = {
53- SUBSCRIPTION_ID = data.azurerm_client_config.current.subscription_id
54- RESOURCE_GROUP_NAME = data.azurerm_resource_group.container_registry.name
55- }
56- }
5743}
You can’t perform that action at this time.
0 commit comments