hi I am still new to terraform and i am probably over complicating something that is really simple I wanted to use map variable to include variables and realised it was not supported. the variable is a secret and is passed during pipeline run. this
my understanding was to use local block for the variables but this seems to cause an error
the goal is to be able to deploy multiple azure container apps quickly by just adding to variables for more container but struggling with the handling of the variable that contains the secret when the pipeline is run.
│ Error: Unsupported attribute
│
│ on main.tf line 38, in resource “azurerm_container_app” “aci_scim_bridge”:
│ 38: value = each.value.scim_secret
│ ├────────────────
│ │ each.value is object with 2 attributes
variable "1_scim_secret"{}
variable "2_scim_secret"{}
variable "container_apps" {
type = map(object({
name = string
description = string
company = string
}))
description = "Map of container applications with their names, descriptions, and scim session secrets."
default = {
1 = {
name = "op-1-cae"
description = "Name of the Container App."
company ="company1"
},
2 = {
name = "op-2-cae"
description = "Name of the Container App."
company = "company2"
}
}
locals {
container_apps_with_secrets = {
1 = merge(
var.container_apps["1"],
{ scim_secret = var.1_scim_secret }
),
2 = merge(
var.container_apps["2"],
{ scim_secret = var.2_scim_secret }
)
}
}