Skip to content

Commit 1480ab2

Browse files
committed
refactor: replace module for AcrPull role assignment with direct resource definition
1 parent bb2ecb2 commit 1480ab2

File tree

1 file changed

+7
-25
lines changed

1 file changed

+7
-25
lines changed

infra/terraform/kubernetes.tf

Lines changed: 7 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -70,29 +70,11 @@ resource "azurerm_role_assignment" "aks_cluster_admin" {
7070
principal_id = data.azurerm_client_config.current.object_id
7171
}
7272

73-
// https://github.com/Azure/terraform-azurerm-avm-res-authorization-roleassignment
74-
module "acr-role" {
75-
count = local.deploy_azure_container_registry ? 1 : 0
76-
source = "Azure/avm-res-authorization-roleassignment/azurerm"
77-
version = "0.3.0"
78-
user_assigned_managed_identities_by_principal_id = {
79-
kubelet_identity = module.aks.kubelet_identity_id
80-
}
81-
role_definitions = {
82-
acr_pull_role = {
83-
name = "AcrPull"
84-
}
85-
}
86-
role_assignments_for_scopes = {
87-
acr_role_assignments = {
88-
scope = module.acr[0].resource_id
89-
role_assignments = {
90-
role_assignment_1 = {
91-
role_definition = "acr_pull_role"
92-
user_assigned_managed_identities = ["kubelet_identity"]
93-
}
94-
}
95-
}
96-
}
97-
depends_on = [module.aks]
73+
// Assign AcrPull role to kubelet identity on ACR
74+
resource "azurerm_role_assignment" "acr_pull" {
75+
count = local.deploy_azure_container_registry ? 1 : 0
76+
scope = module.acr[0].resource_id
77+
role_definition_name = "AcrPull"
78+
principal_id = module.aks.kubelet_identity_id
79+
depends_on = [module.aks]
9880
}

0 commit comments

Comments
 (0)