技术解析

terraform 的 output 问题
0
2021-06-01 16:02:07
idczone

内容:

子 mudule main.tf

    module "ec2s"  {
     source = "xxxxx/aws"

     count = 3
     xxxxx
     instance_type = var.instance_type

     xxxxxx
    }

main.tf:

module "create_ec2s" { 
	source = "./path/ec2s"
    
	for_each = var.instance_types
    
    instan大带宽服务器ce_type = each.value.types
	xxxxx

}

这种嵌套引用,又有 for_each 又有 count 的 instance ip 怎么 output 出来:

output "ips" {
	value = {for p in keys(var.instance_types) : p => module.ec2s[p].xxxx_ip}
}

总是报错, 我也不知道这个 ec2s[p] 是一个什么结构,如何知道这个结构呢 ,




数据地带为您的网站提供全球顶级IDC资源
在线咨询
专属客服