Count errors in latest release and master
TGWolf opened this issue · comments
Error: Invalid count argument
on .terraform/modules/vpc.vpc_peering/main.tf line 62, in resource "aws_route" "requestor":
62: count = var.enabled ? length(distinct(sort(data.aws_route_tables.requestor.0.ids))) * length(data.aws_vpc.acceptor.0.cidr_block_associations) : 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 .terraform/modules/vpc.vpc_peering/main.tf line 71, in resource "aws_route" "acceptor":
71: count = var.enabled ? length(distinct(sort(data.aws_route_tables.acceptor.0.ids))) * length(data.aws_vpc.requestor.0.cidr_block_associations) : 0
Expressing this with for_each
results in the same error
I think this might be the same issue in another module: grem11n/terraform-aws-vpc-peering#49
any updates?
Its still happening
@TGWolf this should reopened
I fixed this issue by, as noted in the error message, using the -target argument. You are using it in apply it should be used in plan.
terraform plan -target="module.<MODULE TO BE PLANNED FIRST>"