cloudposse / terraform-aws-vpc-peering

Terraform module to create a peering connection between two VPCs in the same AWS account.

Home Page:https://cloudposse.com/accelerate

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

examples/complete

mohnishbasha opened this issue · comments

Describe the Bug

The example/complete fails to create resources and runs into failure.

Expected Behavior

example/complete as a unittest case needs to pass and the resources provisioned.

Steps to Reproduce

Steps to reproduce:

  • cd example/complete
  • terraform init
  • terraform plan -var-file=fixtures.us-east-2.tfvars <--- fails
  • terraform apply -var-file=fixtures.us-east-2.tfvars <--- fails

Screenshots


│ Error: Invalid count argument

│ on ../../main.tf line 62, in resource "aws_route" "requestor":
│ 62: count = module.this.enabled ? length(distinct(sort(data.aws_route_tables.requestor[0].ids))) * length(local.acceptor_cidr_blocks) : 0

│ The "count" value depends on resource attributes that cannot be determined until apply, so Terraform cannot predict how many instances
│ will be created. To work around this, use the -target argument to first apply only the resources that the count depends on.


│ Error: Invalid count argument

│ on ../../main.tf line 71, in resource "aws_route" "acceptor":
│ 71: count = module.this.enabled ? length(distinct(sort(data.aws_route_tables.acceptor[0].ids))) * length(local.requestor_cidr_blocks) : 0

│ The "count" value depends on resource attributes that cannot be determined until apply, so Terraform cannot predict how many instances
│ will be created. To work around this, use the -target argument to first apply only the resources that the count depends on.

Environment

  • OS: osx
  • version: 11.4
  • module version - latest/ main branch
  • terraform version: 1.5.0

Additional Context

No response

apparently, module.vpc_peering expects the vpc to be created prior to running itself, due to the data resources it is using.

Added a pr to include a README, if this helps: