-
Notifications
You must be signed in to change notification settings - Fork 9.2k
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
apigateway/integration: Fix parameters issues #40124
Conversation
Community NoteVoting for Prioritization
For Submitters
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 🚀
% make testacc TESTARGS='-run=TestAccAPIGatewayIntegration_' PKG=apigateway
make: Verifying source code with gofmt...
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go1.23.2 test ./internal/service/apigateway/... -v -count 1 -parallel 20 -run=TestAccAPIGatewayIntegration_ -timeout 360m
2024/11/14 10:50:48 Initializing Terraform AWS Provider...
--- PASS: TestAccAPIGatewayIntegration_disappears (17.87s)
--- PASS: TestAccAPIGatewayIntegration_contentHandling (49.39s)
--- PASS: TestAccAPIGatewayIntegration_Parameters_requestCacheKeyUpdate (80.20s)
--- PASS: TestAccAPIGatewayIntegration_TLS_insecureSkipVerification (122.72s)
--- PASS: TestAccAPIGatewayIntegration_Parameters_requestUpdate (134.10s)
--- PASS: TestAccAPIGatewayIntegration_Parameters_cacheKey (238.85s)
--- PASS: TestAccAPIGatewayIntegration_Parameters_cacheKeyUpdate (251.98s)
--- PASS: TestAccAPIGatewayIntegration_basic (413.99s)
--- PASS: TestAccAPIGatewayIntegration_integrationType (654.65s)
PASS
ok github.com/hashicorp/terraform-provider-aws/internal/service/apigateway 661.234s
% make testacc TESTARGS='-run=TestAccAPIGatewayMethod_' PKG=apigateway
make: Verifying source code with gofmt...
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go1.23.2 test ./internal/service/apigateway/... -v -count 1 -parallel 20 -run=TestAccAPIGatewayMethod_ -timeout 360m
2024/11/14 11:03:34 Initializing Terraform AWS Provider...
--- PASS: TestAccAPIGatewayMethod_disappears (15.48s)
--- PASS: TestAccAPIGatewayMethod_customAuthorizer (46.44s)
--- PASS: TestAccAPIGatewayMethod_basic (79.41s)
--- PASS: TestAccAPIGatewayMethod_customRequestValidator (114.61s)
--- PASS: TestAccAPIGatewayMethod_operationName (226.70s)
--- PASS: TestAccAPIGatewayMethod_cognitoAuthorizer (444.29s)
PASS
ok github.com/hashicorp/terraform-provider-aws/internal/service/apigateway 450.735s
This functionality has been released in v5.76.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. Thank you! |
Description
This update introduces a two-stage approach to handle AWS request and cache key parameter updates more reliably due to observed challenges in API Gateway parameter behavior:
Keeping Terraform state in sync with what is in place on AWS is problematic due to these unpredictable, from Terraform's perspective, changes. For example, trying to remove or replace a parameter that state says exists but doesn't actually exist, causes not-found-type errors. Another example is simultaneously performing multiple operations that have the net effect of removing a parameter--the first succeeds but the second gives a not-found-type error.
The sorts of errors seen:
Although not reported, this update also fixes a variety of issues that would have caused problems in some configurations. For example, cache key parameters were not escaped, limiting the naming options without errors.
The new approach:
Stage 1: Request Parameter Updates Only
In the first stage, we update everything except cache key parameters.
Stage 2: Cache Key Parameter Adjustments
After examining results from the first stage (reading AWS rather than relying solely on state), we update the cache key parameters accordingly. For example, replacing (adding back) a poor parameter that got waylaid on her way to visit her grandmother, deep in the forest, with a freshly baked, towering croquembouche. This two-stage approach ensures alignment between the state and AWS.
Relations
Closes #39801
Relates #29991
Closes #29910
Closes #25736
References
The laudable attempt at a fix in #29991 seems to be aimed at the same problem. Unfortunately, that fix was put in the method resource rather than integration. The integration update in the method resource confusingly looked like it was coming from the integration resource itself. In addition, debugging shows that the integration update in the method resource always calls
Update
with an empty set of operations, occasionally causing errors. We’re keeping the #29991 approach in place to avoid potential edge case disruptions, but it may be safe to remove it in the future. For now, we've gated off the integration update in the method resource so that it only callsUpdate
when there are operations to perform.Output from Acceptance Testing