Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Terraform unable to delete the AWS routing table association #20216

Closed
RishiR2 opened this issue Jul 16, 2021 · 5 comments · Fixed by #20265
Closed

Terraform unable to delete the AWS routing table association #20216

RishiR2 opened this issue Jul 16, 2021 · 5 comments · Fixed by #20265
Milestone

Comments

@RishiR2
Copy link

RishiR2 commented Jul 16, 2021

here is the exact error :

Error: error waiting for Route Table Association (rtbassoc-063*) delete: unexpected state 'associated', wanted target ''. last error: %!s()**

note : The VPC and routing table everything created through TF and used "wait" to 2ms to de associate the dependency. But its kind of intermittent issue.
hashicorp/aws v3.50.0 - is the version
and we use TF 0.15 version.

here is the Creation of route table assiciations
######################################################################

-------------- Creating Route Tables Associations ------------------

######################################################################
resource "time_sleep" "wait" {
depends_on = [aws_route_table.prv1_rt,aws_route_table.prv2_rt,aws_route_table.public_rt]
destroy_duration = "2m"
}

Frontend AZ A

resource "aws_route_table_association" "fe_subnet_1_association" {
route_table_id = aws_route_table.prv1_rt.id
subnet_id = aws_subnet.module_frontend_subnet_1.id
depends_on = [time_sleep.wait]
}

Frontend AZ B

resource "aws_route_table_association" "fe_subnet_2_association" {
route_table_id = aws_route_table.prv2_rt.id
subnet_id = aws_subnet.module_frontend_subnet_2.id
depends_on = [time_sleep.wait]
}

#Backend AZ A
resource "aws_route_table_association" "be_subnet_1_association" {
route_table_id = aws_route_table.prv1_rt.id
subnet_id = aws_subnet.module_backend_subnet_1.id
depends_on = [time_sleep.wait]
}
#Backend AZ B
resource "aws_route_table_association" "be_subnet_2_association" {
route_table_id = aws_route_table.prv2_rt.id
subnet_id = aws_subnet.module_backend_subnet_2.id
depends_on = [time_sleep.wait]
}

Public

resource "aws_route_table_association" "public_subnet_1_association" {
route_table_id = aws_route_table.public_rt.id
subnet_id = aws_subnet.module_public_subnet_1.id
depends_on = [time_sleep.wait]
}

Public

resource "aws_route_table_association" "public_subnet_2_association" {
route_table_id = aws_route_table.public_rt.id
subnet_id = aws_subnet.module_public_subnet_2.id
depends_on = [time_sleep.wait]
}

@github-actions github-actions bot added the needs-triage Waiting for first response or review from a maintainer. label Jul 16, 2021
@obourdon
Copy link
Contributor

We also sometimes get this error but it seems transient (aka it is not always occurring). In our case:
terraform: 0.14.11
aws-provider: 3.48.0

@obourdon
Copy link
Contributor

May be changing the following code into

Pending: []string{ec2.RouteTableAssociationStateCodeDisassociating, ec2.RouteTableAssociationStateCodeAssociated},

would fix the issue

@obourdon
Copy link
Contributor

I remember fixing similar issue for placement_group issue #9915 with PR #11671

obourdon added a commit to obourdon/terraform-provider-aws that referenced this issue Jul 21, 2021
ewbankkit added a commit that referenced this issue Jul 21, 2021
@github-actions github-actions bot added this to the v3.51.0 milestone Jul 21, 2021
@github-actions
Copy link

This functionality has been released in v3.51.0 of the Terraform AWS Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you!

@github-actions
Copy link

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 22, 2021
@breathingdust breathingdust removed the needs-triage Waiting for first response or review from a maintainer. label Sep 4, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants