How do you do simple string concatenation in Terraform?

I know this was already answered, but I wanted to share my favorite:

format("%s/%s",var.string,"string2")

Real world example:

locals {
 documents_path = "${var.documents_path == "" ? format("%s/%s",path.module,"documents") : var.documents_path}" 
}

More info:
https://www.terraform.io/docs/configuration/functions/format.html

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)