Skip to content

Commit 64ee2b3

Browse files
authored
fix(azure): add depends_on for azure vendor-access module (#109)
prevent destroy velero_backup_role before user_access_administrator
1 parent 54cfb6f commit 64ee2b3

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

modules/azure/vendor-access/main.tf

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,27 +62,31 @@ resource "azurerm_role_definition" "velero_backup_role" {
6262
not_data_actions = []
6363
not_actions = []
6464
}
65+
depends_on = [azurerm_resource_group.aks]
6566
}
6667

6768
# Grand the sn automation service principal as the Contributor to the AKS resource group
6869
resource "azurerm_role_assignment" "sn_automation" {
6970
scope = azurerm_resource_group.aks.id
7071
role_definition_name = "Contributor"
7172
principal_id = var.sn_automation_principal_id
73+
depends_on = [azurerm_resource_group.aks]
7274
}
7375

7476
# Grand the sn automation service principal as the Azure Kubernetes Service Cluster Admin Role to the AKS resource group
7577
resource "azurerm_role_assignment" "sn_automation_cluster_admin" {
7678
scope = azurerm_resource_group.aks.id
7779
role_definition_name = "Azure Kubernetes Service Cluster Admin Role"
7880
principal_id = var.sn_automation_principal_id
81+
depends_on = [azurerm_resource_group.aks]
7982
}
8083

8184
# Grand the sn support service principal as the Azure Kubernetes Service Cluster User Role to the AKS resource group
8285
resource "azurerm_role_assignment" "sn_support" {
8386
scope = azurerm_resource_group.aks.id
8487
role_definition_name = "Azure Kubernetes Service Cluster User Role"
8588
principal_id = var.sn_support_principal_id
89+
depends_on = [azurerm_resource_group.aks]
8690
}
8791

8892
# Grand the sn automation service principal as the Constrain roles by Role Based Access Control Administrator to the AKS resource group
@@ -92,4 +96,5 @@ resource "azurerm_role_assignment" "user_access_administrator" {
9296
principal_id = var.sn_automation_principal_id
9397
condition_version = "2.0"
9498
condition = templatefile("${path.module}/role-assignment-condition.tpl", { role_definition_id = azurerm_role_definition.velero_backup_role.role_definition_id })
95-
}
99+
depends_on = [azurerm_role_definition.velero_backup_role]
100+
}

0 commit comments

Comments
 (0)