Reference AWS NLB DNS from terraform resource into a variable inside a JSON

When defining a task my container has an environment variable that should reference the dns of the load balance created previously. I tried to use:
“value”: “${aws_nlb.loadbalancename.dns_name}:8080”
but it seems when the container is created it does not replace the value.
Appreciate any help. Last thing missing on my deployment…

Where are you setting that?

Is that in a resource or in a separate file? If a file, take a look at the templatefile() function.

Yes on separate file. I will check, Thanks

The issue was a typo, should use lb instead off nlb. Working fine now. No need to use templatefile()

Thanks