Hi all,
I want to merge local tags in azuread resource in terraform 0.12.17
I try to format the tags in azuread format (differ from azurerm)
i have this
locals {
timestamp = “${timestamp()}”
ad_mandatory_tags = [
map( “app_code” , “var.app_code”,
“app_label” , “var.app_label”,
“app_owner” , “var.app_owner”,
“asset” , “var.asset”,
“environment” , “var.environment”,
“app_criticity” , “var.app_criticity”,
“app_security_level” , “var.app_security_level”,
“auto_shutdown_schedule” , “var.auto_shutdown_schedule”)
]
ad_extra_tags = [
map(“terraform” , “var.terraform”)
]
}
resource “azuread_application” “default” {
name = var.app_registration_name
homepage = var.homepage
available_to_other_tenants = false
oauth2_allow_implicit_flow = true
}
resource “azuread_service_principal” “default” {
application_id = azuread_application.default.application_id
tags = merge(local.ad_mandatory_tags, local.ad_extra_tags)
}
MESSAGE ERROR
Error: Invalid index
on service_principal.tf line 15, in resource “azuread_service_principal” “default”:
15: tags = merge(local.ad_mandatory_tags[0], local.ad_extra_tags[1])
|----------------
| local.ad_extra_tags is tuple with 1 element
The given key does not identify an element in this collection value.
Have you a idea to help me ?