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

aws_vpc_dhcp_options_association cannot be destroyed when vpc is manually deleted #14359

Closed
ialidzhikov opened this issue Jul 27, 2020 · 4 comments · Fixed by #14367
Closed
Labels
bug Addresses a defect in current functionality. service/ec2 Issues and PRs that pertain to the ec2 service.
Milestone

Comments

@ialidzhikov
Copy link
Contributor

ialidzhikov commented Jul 27, 2020

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform CLI and Terraform AWS Provider Version

$ terraform version
Terraform v0.12.20
+ provider.aws v2.70.0

Affected Resource(s)

  • aws_vpc_dhcp_options_association

Terraform Configuration Files

  • main.tf
provider "aws" {
  access_key = var.ACCESS_KEY_ID
  secret_key = var.SECRET_ACCESS_KEY
  region     = "eu-west-1"
}

resource "aws_vpc_dhcp_options" "vpc_dhcp_options" {
  domain_name         = "eu-west-1.compute.internal"
  domain_name_servers = ["AmazonProvidedDNS"]
}

resource "aws_vpc" "vpc" {
  cidr_block           = "10.222.0.0/16"
  enable_dns_support   = true
  enable_dns_hostnames = true
}

resource "aws_vpc_dhcp_options_association" "vpc_dhcp_options_association" {
  vpc_id          = aws_vpc.vpc.id
  dhcp_options_id = aws_vpc_dhcp_options.vpc_dhcp_options.id
}

Debug Output

Panic Output

Expected Behavior

terraform destroy to be able to destroy even when the vpc is manually deleted.

Actual Behavior

terraform destroy fails to destroy when the vpc is manually deleted.

Steps to Reproduce

  1. terraform apply
$ terraform apply -var-file=creds.tfvars

aws_vpc.vpc: Creating...
aws_vpc_dhcp_options.vpc_dhcp_options: Creating...
aws_vpc_dhcp_options.vpc_dhcp_options: Creation complete after 2s [id=dopt-0f75930fb1a3d1234]
aws_vpc.vpc: Creation complete after 8s [id=vpc-025b8d051734e1234]
aws_vpc_dhcp_options_association.vpc_dhcp_options_association: Creating...
aws_vpc_dhcp_options_association.vpc_dhcp_options_association: Creation complete after 1s [id=dopt-0f75930fb1a3d1234-vpc-025b8d051734e1234]

Apply complete! Resources: 3 added, 0 changed, 0 destroyed.
  1. Delete manually the created vpc
aws ec2 delete-vpc --vpc-id vpc-025b8d051734e1234
  1. Ensure that terraform destroy fails to destroy the aws_vpc_dhcp_options_association
$ terraform destroy -var-file=creds.tfvars

aws_vpc_dhcp_options_association.vpc_dhcp_options_association: Destroying... [id=dopt-0f75930fb1a3d1234-vpc-025b8d051734e1234]

Error: InvalidVpcID.NotFound: The vpc ID 'vpc-025b8d051734e1234' does not exist
	status code: 400, request id: foo

Important Factoids

References

  • #0000
@ghost ghost added the service/ec2 Issues and PRs that pertain to the ec2 service. label Jul 27, 2020
@github-actions github-actions bot added the needs-triage Waiting for first response or review from a maintainer. label Jul 27, 2020
@bflad bflad added bug Addresses a defect in current functionality. and removed needs-triage Waiting for first response or review from a maintainer. labels Jul 27, 2020
@DrFaust92
Copy link
Collaborator

opened #14367 to fix

@bflad bflad added this to the v3.1.0 milestone Jul 31, 2020
@bflad
Copy link
Contributor

bflad commented Jul 31, 2020

Related to: #13826

The fix for this has been merged and will release with version 3.1.0 of the Terraform AWS Provider, Thursday next week. Thanks to @DrFaust92 for the fix. 👍

@ghost
Copy link

ghost commented Aug 7, 2020

This has been released in version 3.1.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 for triage. Thanks!

@ghost
Copy link

ghost commented Aug 30, 2020

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 feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!

@ghost ghost locked and limited conversation to collaborators Aug 30, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Addresses a defect in current functionality. service/ec2 Issues and PRs that pertain to the ec2 service.
Projects
None yet
3 participants