I'm trying to update my terraform files from V0.11 to V0.12 and I have some questions.
What's the best way to concatenate variables with strings?
In V0.11 I use this: ${var.name}-STRING-${var.name2}, in V0.12 can I use this: var.name"-STRING-"var.name2 or must I use another ways to concatenate variables and strings?
In v0.12 for interpolations like this:
"${var.example}"
You should use now:
var.example
In your example, In v0.12 you should keep using the previous syntax from v0.11:
"${var.name}-STRING-${var.name2}"
There is a great section in Terraform documentation about migrating to v0.12
To concatenate, check few example below:
If you want to add '@' to string:
value = "${var.username}@${aws_instance.my-instance.public_dns}"
Output: [email protected]
To create link:
value = "http://${aws_instance.my-instance.public_dns}:90"
Output: http://ec2-184-72-11-141.us-west-1.compute.amazonaws.com:90
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With