0

我在 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]

有人可以帮我解决这个问题吗?

4

1 回答 1

1

根据评论。

解决方案是改变:

subnets             = [module.vpc.private_subnets]

进入

subnets             = module.vpc.private_subnets
于 2020-10-16T03:34:40.023 回答