问题描述
问题
如何动态地将地图解压缩到模块/资源属性中?我了解您可以执行dynamic resource attributes blocks in terraform 12/13,但是可以为整个资源/模块的所有属性执行此操作吗?例如:
module "this" {
for_each = {
att0 = "attr0"
attr1 = "attr1"
attr2 = "attr2"
}
each.key = each.value
}
# my hope is that this would do the equivalent of this code below
module "this" {
attr0 = "attr0"
attr1 = "attr1"
attr2 = "attr2"
}
类似于您将splat kwargs转换为函数时在python中的操作方式。例如
# python3
kwargs = {"foo": "bar","bar": "foo"}
my_func(**kwargs)
我尝试过的其他变化形式:
module "this" {
for_each = {
att0 = "attr0"
attr1 = "attr1"
attr2 = "attr2"
}
}
module "this" {
{
att0 = "attr0"
attr1 = "attr1"
attr2 = "attr2"
}
}
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)