Reputation: 1477
I have two strings in Terraform:
"1.1.1.1,2.2.2.2"
"3.3.3.3,4.4.4.4"
How do I get
"1.1.1.1,2.2.2.2,3.3.3.3,4.4.4.4"
Seems very trivial, but could not find a function/workaround for it.
Upvotes: 2
Views: 3389
Reputation: 21716
string templates and join are the immediate solutions I reach for:
locals {
string1 = "1.1.1.1,2.2.2.2"
string2 = "3.3.3.3,4.4.4.4"
strings_join = join(",", [local.string1, local.string2])
strings_template = "${local.string1},${local.string2}"
}
Upvotes: 4