Closed lpossamai closed 2 years ago
Hi!
I'm having a bit of a problem where Terraform things that it needs to add existing aws_route, and it fails to do so because it already exists.
aws_route
I'm using the following:
module "module_depends_on" { count = terraform.workspace == "prod" ? 1 : 0 source = "github.com/grem11n/terraform-aws-vpc-peering" depends_on = [ module.vpc.private_route_table_ids, module.vpc.private_route_table_ids, module.vpc ] providers = { aws.this = aws aws.peer = aws.peer } this_vpc_id = module.vpc.vpc_id peer_vpc_id = var.peer_vpc_id this_rts_ids = module.vpc.private_route_table_ids peer_rts_ids = var.peer_vpc_rts_ids auto_accept_peering = true }
No changes both to the Terraform code nor to the AWS VPC have been done.
terraform state list returns the following:
terraform state list
module.module_depends_on[0].data.aws_caller_identity.peer module.module_depends_on[0].data.aws_caller_identity.this module.module_depends_on[0].data.aws_region.peer module.module_depends_on[0].data.aws_region.this module.module_depends_on[0].data.aws_route_tables.peer_vpc_rts module.module_depends_on[0].data.aws_route_tables.this_vpc_rts module.module_depends_on[0].data.aws_vpc.peer_vpc module.module_depends_on[0].data.aws_vpc.this_vpc module.module_depends_on[0].aws_route.this_routes[0] module.module_depends_on[0].aws_route.this_routes[1] module.module_depends_on[0].aws_route.this_routes[2] module.module_depends_on[0].aws_vpc_peering_connection.this module.module_depends_on[0].aws_vpc_peering_connection_accepter.peer_accepter module.module_depends_on[0].aws_vpc_peering_connection_options.accepter module.module_depends_on[0].aws_vpc_peering_connection_options.this
terraform plan returns the following:
terraform plan
Terraform will perform the following actions: # module.module_depends_on[0].aws_route.peer_routes[0] will be created + resource "aws_route" "peer_routes" { +destination_cidr_block = "10.0.0.0/18" +id = (known after apply) +instance_id = (known after apply) +instance_owner_id = (known after apply) +network_interface_id = (known after apply) +origin = (known after apply) +route_table_id = "rtb-532bf737" +state = (known after apply) +vpc_peering_connection_id = "pcx-06_____b" } # module.module_depends_on[0].aws_route.peer_routes[1] will be created + resource "aws_route" "peer_routes" { +destination_cidr_block = "10.0.0.0/18" +id = (known after apply) +instance_id = (known after apply) +instance_owner_id = (known after apply) +network_interface_id = (known after apply) +origin = (known after apply) +route_table_id = "rtb-5c2bf738" +state = (known after apply) +vpc_peering_connection_id = "pcx-06_____b" } # module.module_depends_on[0].aws_route.peer_routes[2] will be created + resource "aws_route" "peer_routes" { +destination_cidr_block = "10.0.0.0/18" +id = (known after apply) +instance_id = (known after apply) +instance_owner_id = (known after apply) +network_interface_id = (known after apply) +origin = (known after apply) +route_table_id = "rtb-5d2bf739" +state = (known after apply) +vpc_peering_connection_id = "pcx-06_____b" } # module.module_depends_on[0].aws_route.peer_routes[3] will be created + resource "aws_route" "peer_routes" { +destination_cidr_block = "10.0.0.0/18" +id = (known after apply) +instance_id = (known after apply) +instance_owner_id = (known after apply) +network_interface_id = (known after apply) +origin = (known after apply) +route_table_id = "rtb-5e2bf73a" +state = (known after apply) +vpc_peering_connection_id = "pcx-06_____b" } Plan: 4 to add, 0 to change, 0 to destroy.
Terraform version: What Terraform version do you use? 1.1.5
1.1.5
Module version: What module version do you use? latest
latest
Do you have any suggestions on how to fix this?
After trying to import the resource again to Terraform, I was able to. Closing this issue.
Hi!
I'm having a bit of a problem where Terraform things that it needs to add existing
aws_route
, and it fails to do so because it already exists.I'm using the following:
No changes both to the Terraform code nor to the AWS VPC have been done.
terraform state list
returns the following:terraform plan
returns the following:Terraform version: What Terraform version do you use?
1.1.5
Module version: What module version do you use?
latest
Do you have any suggestions on how to fix this?