terraform-aws-modules / terraform-aws-vpn-gateway

Terraform module to create AWS VPN gateway resources 🇺🇦
https://registry.terraform.io/modules/terraform-aws-modules/vpn-gateway/aws
Apache License 2.0
111 stars 156 forks source link

Add create_before_destroy for Customer Gateway resources #69

Closed kai-66degrees closed 2 years ago

kai-66degrees commented 2 years ago

Description

When you try to change the IP for a customer gateway resource, following error is encountered:

Error: error deleting EC2 Customer Gateway (cgw-abcde): IncorrectState: The customer gateway is in use. status code: 400, request id: 1234xyz

I think adding a create_before_destroy to the customer gateway resource should fix it.

pmckl commented 2 years ago

Since the aws_customer_gateway resource creation is happening outside of this module, you can do it easily. But i agree it would make sense to extend the examples with the lifecycle attribute, and a comment why it's necessary.

i've changed one of the examples with the following, and worked as expected:

resource "aws_customer_gateway" "main" {
  bgp_asn    = 65000
  ip_address = "172.83.124.15"
  type       = "ipsec.1"

  tags = {
    Name = "complete-vpn-gateway"
  }
  lifecycle {
    create_before_destroy = true
  }
}
github-actions[bot] commented 2 years ago

This issue has been automatically marked as stale because it has been open 30 days with no activity. Remove stale label or comment or this issue will be closed in 10 days

github-actions[bot] commented 2 years ago

This issue was automatically closed because of stale in 10 days

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.