terraform错误:模块参数的值无效

时间:2020-10-16 02:59:54

标签: amazon-web-services syntax-error terraform terraform-provider-aws terraform-modules

我在转帐计划中遇到此错误:

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]

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

1 个答案:

答案 0 :(得分:1)

基于评论。

解决方案将进行更改:

2

进入

subnets             = [module.vpc.private_subnets]