Skip to content

Commit

Permalink
give products admins user access administrator
Browse files Browse the repository at this point in the history
  • Loading branch information
andreasisnes committed Jul 16, 2024
1 parent 92cd2c5 commit 3d71d65
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions infrastructure/products/azure_arm.tf
Original file line number Diff line number Diff line change
Expand Up @@ -203,12 +203,20 @@ resource "azurerm_role_assignment" "admins" {

# https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/role_assignment
resource "azurerm_role_assignment" "product_admins_storage_blob_owner" {
scope = azurerm_storage_account.backend.id
scope = azurerm_storage_container.container.resource_manager_id
principal_id = azuread_group.product_admins.object_id
role_definition_name = data.azurerm_role_definition.storage_blob_data_owner.name
# skip_service_principal_aad_check = true
}

# https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/role_assignment
resource "azurerm_role_assignment" "product_admins_user_access_administrator" {
scope = azurerm_storage_container.container.resource_manager_id
principal_id = azuread_group.product_admins.object_id
role_definition_name = data.azurerm_role_definition.user_access_administrator.name
# skip_service_principal_aad_check = true
}

# https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/role_assignment
resource "azurerm_role_assignment" "product_admins_contributor" {
scope = data.azurerm_resource_group.tfstate.id
Expand All @@ -217,14 +225,13 @@ resource "azurerm_role_assignment" "product_admins_contributor" {
# skip_service_principal_aad_check = true
}


# https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/role_assignment
resource "azurerm_role_assignment" "products" {
scope = azurerm_storage_container.container.resource_manager_id
principal_id = azuread_group.admins[each.value.slug].object_id
role_definition_name = data.azurerm_role_definition.storage_blob_data_owner.name

depends_on = [azurerm_role_assignment.product_admins_contributor]
depends_on = [azurerm_role_assignment.product_admins_user_access_administrator]

condition_version = "2.0"
condition = <<-EOT
Expand All @@ -251,7 +258,7 @@ resource "azurerm_role_assignment" "appregg" {
role_definition_name = data.azurerm_role_definition.storage_blob_data_owner.name
skip_service_principal_aad_check = true

depends_on = [azurerm_role_assignment.product_admins_contributor]
depends_on = [azurerm_role_assignment.product_admins_user_access_administrator]

condition_version = "2.0"
condition = <<-EOT
Expand Down

0 comments on commit 3d71d65

Please sign in to comment.