-1

I am trying to create 3 ec2 instances in private subnet. Using ec2-module.tf from below git repo

https://github.com/quickbooks2018/Terraform-Classic-Modules

Below is the line I enabled in tf file

ec2-subnets-ids = ["${module.vpc.private-subnet-ids}"]

Error looks below,

Error: Invalid value for module argument

on ec2-module.tf line 17, in module "ec2-app-v1": 17: ec2-subnets-ids = ["${module.vpc.private-subnet-ids}"]

The given value is not suitable for child module variable "ec2-subnets-ids" defined at modules/ec2/ec2-variables.tf:46,1-27: element 0: string required.

Please help to understand the error and how to fix it.

4

1 回答 1

0

Looking at those modules you're referencing it looks like the issue is that you're passing a list of list of strings but should just be passing a list of strings.

So, instead of

ec2-subnets-ids = ["${module.vpc.private-subnet-ids}"]

which passes a list of a single element (that element being a list of strings), try

ec2-subnets-ids = "${module.vpc.private-subnet-ids}"

which just passes the list forward.

于 2020-02-14T17:27:44.880 回答