Skip to content

Commit

Permalink
Fix managed identity container_groups, input can be id
Browse files Browse the repository at this point in the history
  • Loading branch information
Hein Tonny Køien committed Apr 9, 2024
1 parent 3133883 commit f3995e7
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions modules/compute/container_group/managed_identities.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,24 @@
#

locals {
// Adjusted to handle direct identity ID if provided
managed_direct_identity = try(var.settings.identity.id != null ? [var.settings.identity.id] : [], [])

managed_local_identities = flatten([
for managed_identity_key in try(var.settings.identity.managed_identity_keys, []) : [
var.combined_resources.managed_identities[var.client_config.landingzone_key][managed_identity_key].id
try(var.combined_resources.managed_identities[var.client_config.landingzone_key][managed_identity_key].id, null)
]
])

managed_remote_identities = flatten([
for lz_key, value in try(var.settings.identity.remote, []) : [
for managed_identity_key in value.managed_identity_keys : [
var.combined_resources.managed_identities[lz_key][managed_identity_key].id
for managed_identity_key in try(value.managed_identity_keys, []) : [
try(var.combined_resources.managed_identities[lz_key][managed_identity_key].id, null)
]
]
])

managed_identities = concat(local.managed_local_identities, local.managed_remote_identities)
// Include the direct identity ID in the final list
managed_identities = concat(local.managed_direct_identity, local.managed_local_identities, local.managed_remote_identities)
}

0 comments on commit f3995e7

Please sign in to comment.