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

Deleted aws_customer_gateway is not re-created #7137

Closed
clstokes opened this issue Jun 12, 2016 · 2 comments
Closed

Deleted aws_customer_gateway is not re-created #7137

clstokes opened this issue Jun 12, 2016 · 2 comments

Comments

@clstokes
Copy link
Contributor

Terraform does not re-create a deleted AWS customer gateway (CGW). If I create a CGW with Terraform, then delete it out-of-band of Terraform (via CLI or the AWS console), Terraform will fail with a Error finding CustomerGateway error on the next refresh, plan, or apply, rather than re-creating the CGW.

Terraform Version

$ terraform version
Terraform v0.6.16

Affected Resource(s)

  • aws_customer_gateway

Terraform Configuration Files

resource "aws_customer_gateway" "main" {
  bgp_asn    = 60000
  ip_address = "172.83.124.10"
  type       = "ipsec.1"

  tags {
    Name = "recreate-test"
  }
}

output "cgw_id" {
  value = "${aws_customer_gateway.main.id}"
}

Expected Behavior

Terraform should recognize that the CGW has been deleted and re-create it if still present in my configuration.

Actual Behavior

Terraform fails to refresh, plan, or apply with a Error finding CustomerGateway error.

Steps to Reproduce

  1. terraform apply
  2. aws ec2 describe-customer-gateways --customer-gateway-id $(terraform output cgw_id)
  3. aws ec2 delete-customer-gateway --customer-gateway-id $(terraform output cgw_id)
  4. aws ec2 describe-customer-gateways --customer-gateway-id $(terraform output cgw_id)
  5. Repeat previous step until the CGW is no longer present. Note: It will stay in deleted state for 30 minutes or more. To reproduce, you must wait until after the CGW is no longer present in the response.
  6. terraform apply
  7. Observe Terraform fail with an error.

Output

$ terraform plan
Refreshing Terraform state prior to plan...

aws_customer_gateway.main: Refreshing state... (ID: cgw-48cb2521)
Error refreshing state: 1 error(s) occurred:

* aws_customer_gateway.main: [ERROR] Error finding CustomerGateway: cgw-48cb2521
$

References

@stack72
Copy link
Contributor

stack72 commented Jun 29, 2016

This will be fixed by the solution as provided in #7136

Closing this to track the changes / requests there

@ghost
Copy link

ghost commented Apr 24, 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 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.

@ghost ghost locked and limited conversation to collaborators Apr 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants