How do we define a name with Concat taken from multiple variable

Hi All,

Anybody can help me out to define a name on file with concat from multiple variable, for example we would like to use name, environment, domain which is already define on the file

Thank you for your help.



What you’re looking for is called string interpolation:

bent@DESKTOP-KEO4V17:/tmp/concatvars$ cat
variable "name" {
  default = "server"
variable "environment" {
  default = "test"
variable "domain" {
  default = ""

output "fqdn" {
  value = "${var.environment}-${}.${var.domain}"

bent@DESKTOP-KEO4V17:/tmp/concatvars$ terraform apply

Apply complete! Resources: 0 added, 0 changed, 0 destroyed.


fqdn =
1 Like

Hi Bent, thank a lot for your help, is it working well, great job and many thanks

1 Like