hashicorp / terraform-provider-aws

The AWS Provider enables Terraform to manage AWS resources.
https://registry.terraform.io/providers/hashicorp/aws
Mozilla Public License 2.0
9.75k stars 9.11k forks source link

r/vpn_connection r/customer_gateway: Error creating vpn connection: InvalidCustomerGatewayID.NotFound #19556

Closed YakDriver closed 1 year ago

YakDriver commented 3 years ago

Community Note

Terraform CLI and Terraform AWS Provider Version

Terraform v0.15.4

Affected Resource(s)

Terraform Configuration Files

Please include all Terraform configurations required to reproduce the bug. Bug reports without a functional reproduction may be closed without investigation.

resource "aws_customer_gateway" "customer_gateway" {
  bgp_asn    = 65000
  ip_address = "178.0.0.1"
  type       = "ipsec.1"
  tags = {
    Name = "tf-acc-test-ec2-vpn-connection-enable-acceleration"
  }
}

resource "aws_vpn_connection" "test" {
  customer_gateway_id = aws_customer_gateway.customer_gateway.id
  transit_gateway_id  = aws_ec2_transit_gateway.test.id
  type                = "ipsec.1"
  static_routes_only  = false
  enable_acceleration = false

  local_ipv6_network_cidr  = "1111:2222:3333:4444::/64"
  remote_ipv6_network_cidr = "5555:6666:7777::/48"
  tunnel_inside_ip_version = "ipv6"

  tunnel1_inside_ipv6_cidr = "fd00:2001:db8:2:2d1:81ff:fe41:d200/126"
  tunnel2_inside_ipv6_cidr = "fd00:2001:db8:2:2d1:81ff:fe41:d204/126"
}

Debug Output

        Error: Error creating vpn connection: InvalidCustomerGatewayID.NotFound: The customerGateway ID 'cgw-062551d454e44313b' does not exist
            status code: 400, request id: 35fc745e-b7a9-4f92-84fe-31911abc45e8

          with aws_vpn_connection.test,
          on terraform_plugin_test.tf line 11, in resource "aws_vpn_connection" "test":
          11: resource "aws_vpn_connection" "test" {

Expected Behavior

Should create aws_vpn_connection. This only occurs on rare occasions. As such, it is likely an eventual consistency problem on the aws_customer_gateway side, which should verify it is available prior to leaving Create().

Actual Behavior

aws_vpn_connection fails due to aws_customer_gateway not existing (yet, possibly).

Steps to Reproduce

  1. terraform apply

References

github-actions[bot] commented 1 year ago

Marking this issue as stale due to inactivity. This helps our maintainers find and focus on the active issues. If this issue receives no comments in the next 30 days it will automatically be closed. Maintainers can also remove the stale label.

If this issue was automatically closed and you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thank you!

github-actions[bot] commented 1 year ago

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.