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

fix apigw cache waiting logic when cache size provided but not cache enabled #23091

Merged

Conversation

alpacamybags118
Copy link
Contributor

Community Note

  • Please vote on this pull request by adding a 👍 reaction to the original pull request comment to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for pull request followers and do not help prioritize the request

Closes #22866

This PR fixes the issue described in #22866 . The logic for waiting for the cache has been updated to do the following:

  1. On APIGW creation, only wait for the cache if cache_cluster_enabled is true
  2. On APIGW update, only wait on the cache if cache_cluster_enabled is enabled, or cache_cluster_size is updated when cache_cluster_enabled is already true

I wrote a new acceptance test for these scenarios but it may be redundant with the existing tests. I can adjust as needed.

Output from acceptance testing:

make testacc TESTS=TestAccAPIGatewayStage_cache_size_cache_disabled PKG=apigateway
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/apigateway/... -v -count 1 -parallel 20 -run='TestAccAPIGatewayStage_cache_size_cache_disabled'  -timeout 180m
=== RUN   TestAccAPIGatewayStage_cache_size_cache_disabled
=== PAUSE TestAccAPIGatewayStage_cache_size_cache_disabled
=== CONT  TestAccAPIGatewayStage_cache_size_cache_disabled
--- PASS: TestAccAPIGatewayStage_cache_size_cache_disabled (313.16s)
PASS
ok      github.com/hashicorp/terraform-provider-aws/internal/service/apigateway 313.223s

...

@github-actions github-actions bot added size/M Managed by automation to categorize the size of a PR. needs-triage Waiting for first response or review from a maintainer. service/apigateway Issues and PRs that pertain to the apigateway service. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. labels Feb 10, 2022
@alpacamybags118 alpacamybags118 force-pushed the b-aws_apigw_waiter_not_available branch from 523cf85 to f76a539 Compare February 10, 2022 01:13
@alpacamybags118 alpacamybags118 marked this pull request as ready for review February 10, 2022 01:13
@DrFaust92 DrFaust92 added bug Addresses a defect in current functionality. and removed needs-triage Waiting for first response or review from a maintainer. labels Feb 10, 2022
@ewbankkit
Copy link
Contributor

Relates: #18561.

Copy link
Contributor

@ewbankkit ewbankkit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🚀.

% make testacc TESTS=TestAccAPIGatewayStage_ PKG=apigateway ACCTEST_PARALLELISM=2
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/apigateway/... -v -count 1 -parallel 2 -run='TestAccAPIGatewayStage_'  -timeout 180m
=== RUN   TestAccAPIGatewayStage_basic
=== PAUSE TestAccAPIGatewayStage_basic
=== RUN   TestAccAPIGatewayStage_cache
=== PAUSE TestAccAPIGatewayStage_cache
=== RUN   TestAccAPIGatewayStage_cache_size_cache_disabled
=== PAUSE TestAccAPIGatewayStage_cache_size_cache_disabled
=== RUN   TestAccAPIGatewayStage_Disappears_referencingDeployment
=== PAUSE TestAccAPIGatewayStage_Disappears_referencingDeployment
=== RUN   TestAccAPIGatewayStage_tags
=== PAUSE TestAccAPIGatewayStage_tags
=== RUN   TestAccAPIGatewayStage_disappears
=== PAUSE TestAccAPIGatewayStage_disappears
=== RUN   TestAccAPIGatewayStage_disappears_restApi
=== PAUSE TestAccAPIGatewayStage_disappears_restApi
=== RUN   TestAccAPIGatewayStage_accessLogSettings
=== PAUSE TestAccAPIGatewayStage_accessLogSettings
=== RUN   TestAccAPIGatewayStage_AccessLogSettings_kinesis
=== PAUSE TestAccAPIGatewayStage_AccessLogSettings_kinesis
=== RUN   TestAccAPIGatewayStage_waf
=== PAUSE TestAccAPIGatewayStage_waf
=== CONT  TestAccAPIGatewayStage_basic
=== CONT  TestAccAPIGatewayStage_disappears
--- PASS: TestAccAPIGatewayStage_disappears (44.03s)
=== CONT  TestAccAPIGatewayStage_AccessLogSettings_kinesis
--- PASS: TestAccAPIGatewayStage_basic (81.00s)
=== CONT  TestAccAPIGatewayStage_waf
--- PASS: TestAccAPIGatewayStage_waf (76.80s)
=== CONT  TestAccAPIGatewayStage_Disappears_referencingDeployment
--- PASS: TestAccAPIGatewayStage_Disappears_referencingDeployment (31.59s)
=== CONT  TestAccAPIGatewayStage_tags
--- PASS: TestAccAPIGatewayStage_AccessLogSettings_kinesis (213.45s)
=== CONT  TestAccAPIGatewayStage_accessLogSettings
--- PASS: TestAccAPIGatewayStage_tags (68.41s)
=== CONT  TestAccAPIGatewayStage_disappears_restApi
--- PASS: TestAccAPIGatewayStage_disappears_restApi (32.89s)
=== CONT  TestAccAPIGatewayStage_cache_size_cache_disabled
--- PASS: TestAccAPIGatewayStage_accessLogSettings (103.58s)
=== CONT  TestAccAPIGatewayStage_cache
--- PASS: TestAccAPIGatewayStage_cache_size_cache_disabled (235.48s)
--- PASS: TestAccAPIGatewayStage_cache (454.77s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/apigateway	819.540s

@ewbankkit
Copy link
Contributor

@alpacamybags118 Thanks for the contribution 🎉 👏.
I modified the PR a bit to include some of the logic that was removed in #18561.

@ewbankkit ewbankkit merged commit 029ca0f into hashicorp:main Mar 16, 2022
@github-actions github-actions bot added this to the v4.6.0 milestone Mar 16, 2022
@github-actions
Copy link

This functionality has been released in v4.6.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!

@github-actions
Copy link

github-actions bot commented May 7, 2022

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 7, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Addresses a defect in current functionality. service/apigateway Issues and PRs that pertain to the apigateway service. size/M Managed by automation to categorize the size of a PR. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

unexpected state 'NOT_AVAILABLE', wanted target 'AVAILABLE' in aws_api_gateway_stage
3 participants