我有一个map类型的变量,该变量具有实例类型的索引值。现在,我在索引中使用单aws单实例类:-
default = {
"0" = "r4.2xlarge"
"1" = "m4.large"
"2" = "r4.4xlarge"
"3" = "m3.xlarge"
"4" = "m3.xlarge"
"5" = "m4.xlarge"
"6" = "m4.xlarge"
"7" = "c4.xlarge"
"8" = "m4.large"
"9" = "m4.large" }
我的地形调用索引如下:-
instance_types {
spot = ["${lookup(var.spot_instance_types, count.index)}"]
}
我想在地图中将多个实例类作为列表添加的内容,例如:-
default = {
"0" = ["r4.2xlarge","r4.xlarge"]
"1" = ["m4.large","m4.xlarge"]
"2" = ["r4.4xlarge","r4.xlarge"]
"3" = ["m3.xlarge","m4.xlarge"]
"4" = ["m3.xlarge","m4.xlarge"]
"5" = ["m4.xlarge","m4.large"]
"6" = ["m4.xlarge","m4.large"]
"7" = ["c4.xlarge","c4.large"]
"8" = ["m4.large","m4.xlarge"]
"9" = ["m4.large","m4.xlarge"] }
Terraform Apply抛出以下错误:
错误:spotinst_aws_group.private_servers:发生了10个错误:
$ {lookup(var.spot_instance_types,count.index)} * spotinst_aws_group.private_servers [7]:lookup:lookup()仅可用于平面地图,该地图包含以下类型的列表元素:
$ {lookup(var.spot_instance_types,count.index)} * spotinst_aws_group.private_servers [2]:lookup:lookup()仅可用于平面地图,该地图包含以下类型的列表元素:
$ {lookup(var.spot_instance_types,count.index)} * spotinst_aws_group.private_servers [0]:lookup:lookup()仅可用于平面地图,该地图包含以下类型的列表元素:
$ {lookup(var.spot_instance_types,count.index)} * spotinst_aws_group.private_servers [8]:lookup:lookup()仅可用于平面地图,该地图包含以下类型的列表元素:
$ {lookup(var.spot_instance_types,count.index)} * spotinst_aws_group.private_servers [1]:lookup:lookup()仅可用于平面地图,该地图包含以下类型的列表元素:
$ {lookup(var.spot_instance_types,count.index)} * spotinst_aws_group.private_servers [6]:lookup:lookup()仅可用于平面地图,该地图包含以下类型的list元素:
$ {lookup(var.spot_instance_types,count.index)} * spotinst_aws_group.private_servers [9]:lookup:lookup()仅可用于平面地图,该地图包含以下类型的列表元素:
$ {lookup(var.spot_instance_types,count.index)} * spotinst_aws_group.private_servers [5]:lookup:lookup()仅可用于平面地图,该地图包含以下类型的列表元素:
$ {lookup(var.spot_instance_types,count.index)} * spotinst_aws_group.private_servers [4]:lookup:lookup()仅可用于平面地图,该地图包含以下类型的列表元素:
$ {lookup(var.spot_instance_types,count.index)}
有没有一种方法可以做到?甚至有可能吗?到目前为止,无法从任何人那里得到答案。