Skip to main content
Knowledge Base

VPC error due to dependency on var.num_destination_vpc_route_tables

Answer

r:terraform-aws-vpc ``` [ecs-deploy-runner][2022-03-03T13:25:00+0000] ╷ [ecs-deploy-runner][2022-03-03T13:25:00+0000] │ Error: Invalid count argument [ecs-deploy-runner][2022-03-03T13:25:00+0000] │ [ecs-deploy-runner][2022-03-03T13:25:00+0000] │ on .terraform/modules/vpc.vpc_peering_connection/modules/vpc-peering/main.tf line 74, in resource "aws_route" "destination_to_origin": [ecs-deploy-runner][2022-03-03T13:25:00+0000] │ 74: count = var.create_resources ? var.num_destination_vpc_route_tables : 0 [ecs-deploy-runner][2022-03-03T13:25:00+0000] │ [ecs-deploy-runner][2022-03-03T13:25:00+0000] │ The "count" value depends on resource attributes that cannot be determined [ecs-deploy-runner][2022-03-03T13:25:00+0000] │ until apply, so Terraform cannot predict how many instances will be [ecs-deploy-runner][2022-03-03T13:25:00+0000] │ created. To work around this, use the -target argument to first apply only [ecs-deploy-runner][2022-03-03T13:25:00+0000] │ the resources that the count depends on. ```

> Thanks. I just solved by removing the pairing from common! Issue solved by the customer :)