Skip to content

Commit c0c3dd3

Browse files
committed
fix: multiple replicators can exist in a tenant
1 parent cb5cfd1 commit c0c3dd3

File tree

1 file changed

+6
-2
lines changed
  • modules/meshcloud-replicator-service-principal

1 file changed

+6
-2
lines changed

modules/meshcloud-replicator-service-principal/module.tf

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ terraform {
1515
}
1616
}
1717

18+
locals {
19+
spp_hash = substr(sha256(var.service_principal_name), 0, 5)
20+
}
21+
1822
//---------------------------------------------------------------------------
1923
// Role Definition for the Replicator on the specified Scope
2024
//---------------------------------------------------------------------------
@@ -187,7 +191,7 @@ resource "azuread_app_role_assignment" "meshcloud_replicator-user" {
187191
// Assign it to the specified scope
188192
//---------------------------------------------------------------------------
189193
resource "azurerm_policy_definition" "privilege_escalation_prevention" {
190-
name = "meshcloud-privilege-escalation-prevention"
194+
name = "meshcloud-privilege-escalation-prevention-${local.spp_hash}"
191195
policy_type = "Custom"
192196
mode = "All"
193197
display_name = "meshcloud Privilege Escalation Prevention"
@@ -216,7 +220,7 @@ RULE
216220

217221

218222
resource "azurerm_management_group_policy_assignment" "privilege-escalation-prevention" {
219-
name = "mesh-priv-escal-prev"
223+
name = "msh-escal-prev-${local.spp_hash}"
220224
policy_definition_id = azurerm_policy_definition.privilege_escalation_prevention.id
221225
management_group_id = var.custom_role_scope
222226
}

0 commit comments

Comments
 (0)