Combine terragrunt.hcl inputs

I am wanting to combine terragrunt variables. For example

inputs = {
var1 = “hello”
var2 = “world”
var3 = var1 + var2
}

Is this possible? I am not able to find this in the documentation.

Yep, it’s possible! Here’s one way to do it:

locals {
  var1 = "hello"
  var2 = "world"
}

inputs = {
  var1 = local.var1
  var2 = local.var2
  var3 = "${local.var1} ${local.var2}"
}

Refer to the locals feature docs.

You could also use the join() function:

locals {
  var1 = "hello"
  var2 = "world"
}

inputs = {
  var1 = local.var1
  var2 = local.var2
  var3 = join(" ", [local.var1, local.var2])
}

See the docs on built-in functions.