我在tf计划中收到此错误:

Error: Invalid value for module argument

  on ec2_asg.tf line 13, in module "ec2_asg":
  13:   subnets             = [module.vpc.private_subnets]

The given value is not suitable for child module variable "subnets" defined at
.terraform/modules/ec2_asg/variables.tf:388,1-19: element 0: string required.
这是模块中的变量:
variable "subnets" {
  description = "List of subnets for Application. e.g. ['subnet-8da92df7', 'subnet-9e5dc5f6', 'subnet-497eaf33']"
  type        = list(string)
}
这在.tf文件中:
  ......
  ......
  scaling_max         = var.scaling_max_bi
  subnets             = [module.vpc.private_subnets]
  security_groups     = [aws_security_group.id]
有人可以帮我解决这个问题吗?

最佳答案

根据评论。
解决方案进行了更改:

subnets             = [module.vpc.private_subnets]
进入
subnets             = module.vpc.private_subnets

关于amazon-web-services - terraform错误: Invalid value for module argument,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/64382320/

10-09 09:08