Team,
I have a input json which is having some environmental details in the form of map.
"env" : {
"dev":{
"backendAppId" : "XXXXXXXXXXXXXXXXXXXXX",
"backendServiceUrl" :"https://dev-url",
"roleName" :"Dev.Access"
},
"dit":{
"backendAppId" : "YYYYYYYY",
"backendServiceUrl" :"https://dit-url",
"roleName" :"Dit.Access"
}
}
For each environment , we have a key and it corresponding values.
We are using Infrastructure as a code for the Azure api manager and replacing this values at run time in the policy file.
My question is if we are deploying in Dev we need to get the Dev env information and use it.
Below is the data template we are using , based on the env input we need to pick the right value.
data "template_file" "api_policy_file" {
template = file(each.value.policyFile)
vars = {
tenant_id = var.tenant_id
for {
**backend_app_id = env.get(dev).backendAppId**
}
}
}
Can you please help me how to iterate through map and get the value based on the condition .