I could use some help figuring out how to combine a list of strings with a map (key/value) and then this new map has a different value.
variable "app_roles_with_rule" {
type = map(any)
default = { "User" = "user.userType == 'hrisUser' AND user.employmentStatus == 'Active'" }
}
variable "app_roles_without_rule" {
type = list(string)
default = ["Admin", "Super_Duper_Admin"]
}
variable "app_name" {
type = string
default = "FancyPantsApp"
}
locals {
all_app_roles = {
#Fake psudo code:
#
#all_app_roles = {}
#for single_role in app_roles_with_rule
# {
# all_app_roles += {single_role : "Application: ${var.app_name} - ${single_role.key} Role (with default access rules)"}
# }
#for single_role in app_roles_without_rule
# {
# all_app_roles += {single_role : "Application: ${var.app_name} - ${single_role} Role (without default access rules)"}
# }
}
}
output "example" {
value = local.all_app_roles
}
# local.all_app_roles returns this
# [
# { "User" = "Application: FancyPantsApp - User Role (with default access rules)" },
# { "Admin" = "Application: FancyPantsApp - Admin Role (without default access rules)" },
# { "Super_Duper_Admin" = "Application: FancyPantsApp - Super_Duper_Admin Role (without default access rules)" }
# ]