terraform-aws-modules / terraform-aws-apigateway-v2

Terraform module to create AWS API Gateway v2 (HTTP/WebSocket) 🇺🇦
https://registry.terraform.io/modules/terraform-aws-modules/apigateway-v2/aws
Apache License 2.0
144 stars 188 forks source link

Feat: Add create_before_destroy lifecycle to integration resources #55

Closed dacahill7 closed 2 years ago

dacahill7 commented 2 years ago

Description

This change adds a lifecycle policy to the aws_apigatewayv2_integration to allow for more stable changes to existing resources.

Motivation and Context

If there is a terraform change replacing both an API Gateway Route and an API Gateway Integration, it can run into an issue where a VPC link is being destroyed as the old Gateway Route is being deleted. The error becomes: Cannot delete Integration because it is referenced by the following Routes with Ids:

In the documentation for aws api_gateway_deployment, it suggests to use a lifecycle block to create_before_destroy, allowing for the VPC link to be connected to the new API Gateway Route before destroying the connection. This also prevents downtime between moving the link.

How Has This Been Tested?

antonbabenko commented 2 years ago

Hi @dacahill7 !

The documentation link is pointing to another type of API Gateway service (REST) but not to HTTP API Gateway which we support in this module.

I think your PR is needed so I am merging it.

antonbabenko commented 2 years ago

v1.4.0 has been just released.

github-actions[bot] commented 1 year ago

I'm going to lock this pull request 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 related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.