I am trying to simply my variables/tfvars. I usually export out from other tools to a csv/json & have to edit the JSON similar to :
app_list = [{
name = "app1"
BC = "001"
"Group" = "IT"
},
{
name = "app2"
BC = "001"
"Group" = "IT"
}]
in my Main.tf I use
for_each = { for n in var.app_list : n.name => n }
name = upper(join("-", [var.prefix, each.value.name, var.env]))
the above works; however I would like to maintain my list/array as:
{"application1"="app1"}
{"owner"= "Arjuna the great"}
I am not sure how to reference these as I am unable to use each.key and each.value (i.e. each.key should contain “application1” && “owner”)
is this possible with the for_each or for loops in terraform/HCL?
Most machine exports will save date in the above format & it would be easy to just export machine output and use that as tfvars.
I am trying to bulk create secrets in Azure key vault using a table as reference.
secret_Name | Secret_value |
---|---|
vmpassword | somerandom |
vmowner | Krishna |
APIkey | somerandomstring |