The below is the custom variable that will use for specific AWS resource creation
INPUT Variable:
VAR = {
"commonPolicy" = [
"DenyRootUser",
"denyIamAccessKeyCreation"
]
"extraPolicy" = [
"denyGlobalService",
"denyBillingModify"
]
}
The interpolation/modification method i am using below to modify the value using Terraform console.
Method:
> { for i,j in var.VAR : "${i}" => [ for k in j : "file('policies/${k}.json')}" ] }
Through this method i am able to get this value when i parse value from specific key:
Like this:
> { for i,j in var.VAR : "${i}" => [ for k in j : "file('policies/${k}.json')}" ] }["commonPolicy"]
OUTPUT:
[
"file('policies/DenyRootUser.json')}",
"file('policies/denyIamAccessKeyCreation.json')}",
]
But the following value i want from interpolation method
Expected Output:
[
file("policies/DenyRootUser.json")},
file("policies/denyIamAccessKeyCreation.json")},
]
NOTE:
- The difference between output & expected output is that i want list of values without doube quotes.
- under file function, the location/path should be under double quotes.