且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

将字符串附加到 Terraform 中列表的每个元素

更新时间:2023-08-26 21:36:28

你试过了吗formatlist()?

例如:

my_list_var = ["a", "b", "c"]
my_new_list = formatlist("%s-foo", var.mylist)

my_new_list 将是:

my_new_list will be:

["a-foo", "b-foo", "c-foo"]

你也可以传递另一个相同长度的列表作为参数来为每个元素附加不同的字符串.

Yo can also pass another list of the same length as parameter to append different strings to each element.