hi,
I have a python lambda function that have an environment variable that is different depending on the region and environment. in the terraform main file I have the following code to look up the a local variable below. but it is giving me the following error. can you advise how I can lookup the variable
main.tf
EP_URL: try(local.ep_urls[${var.region_short}][${var.env}], null)
locals.tf
ep_urls = {
"euw1" = {
"dev" = "https://es-dev-euw1-h5dfsdrsbij7tbjiehcwmcima.us-east-1.es.amazonaws.com:443",
"qa" = "https://es-qa-euw1-h5dfsdrsbij7tbjiehcwmcima.us-east-1.es.amazonaws.com:443",
}
"use1" = {
"dev" = "https://es-dev-use1-h5dfsdrsbij7tbjiehcwmcima.us-east-1.es.amazonaws.com:443",
"qa" = "https://es-qa-use1-h5dfsdrsbij7tbjiehcwmcima.us-east-1.es.amazonaws.com:443",
}
}
error
On ../../../modules/lambda/main.tf line 36: Expected the start of an
│ expression, but found an invalid expression token.
│ Error: Invalid character
│ On ../../../modules/lambda/main.tf line 36: This character is not used
│ within the language.