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

b/aws_redshiftserverless_workgroup: Fix base_capacity, max_capacity ordered updates and max_capacity limit removal #36032

Conversation

marcinbelczewski
Copy link

Description

This PR fixes base_capacity and max_capacity update logic, where due to the nature of AWS API, the ordering of updates depends on the current and the new values of base_capacity and max_capacity.

Also, PR implements a fix allowing for max_capacity limit removal. AWS API behavior for this is non-idempotent and as of now unclearly documented.

Relations

Closes #36030
Closes #36031

References

UpdateWorkgroup request in AWS API.

I have also received guidance from AWS Support regarding the procedure for removing maximum capacity. To do this, the UpdateWorkgroup request must include a -1 value for maxCapacity. However, the API is not idempotent, meaning that submitting a repeated request with a -1 value for maxCapacity will result in an error. This poses a challenge for the implementation by providers.

Output from Acceptance Testing

% make testacc TESTS=TestAccRedshiftServerlessWorkgroup_baseAndMaxCapacityAndPubliclyAccessible PKG=redshiftserverless

Warning! The acceptance test may occasionally encounter a failure with the error: An error occurred (ConflictException) when calling the UpdateWorkgroup operation: There is an operation running on the workgroup. Try to update it later. This issue appears to stem from a suspected bug in the AWS APIs. Despite the GetWorkgroup API request indicating the workgroup is AVAILABLE after recent updates, an immediate subsequent UpdateWorkgroup request can still fail. This suggests a race condition within the API. I have reported this issue to AWS Support and have also followed up with Amazon Technical Account Managers (TAMs) accessible through my workplace.

Copy link

Community Note

Voting for Prioritization

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

For Submitters

  • Review the contribution guide relating to the type of change you are making to ensure all of the necessary steps have been taken.
  • For new resources and data sources, use skaff to generate scaffolding with comments detailing common expectations.
  • Whether or not the branch has been rebased will not impact prioritization, but doing so is always a welcome surprise.

@github-actions github-actions bot added size/L Managed by automation to categorize the size of a PR. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. service/redshiftserverless Issues and PRs that pertain to the redshiftserverless service. labels Feb 29, 2024
@terraform-aws-provider terraform-aws-provider bot added the needs-triage Waiting for first response or review from a maintainer. label Feb 29, 2024
@marcinbelczewski marcinbelczewski force-pushed the b-aws_redshiftserverless_workgroup-capacity-update branch from b6901f0 to d6ab53f Compare February 29, 2024 16:36
…rdered updates and max_capacity limit removal
@marcinbelczewski marcinbelczewski force-pushed the b-aws_redshiftserverless_workgroup-capacity-update branch from d6ab53f to e024709 Compare February 29, 2024 16:57
@marcinbelczewski marcinbelczewski marked this pull request as ready for review February 29, 2024 16:57
@ewbankkit ewbankkit added bug Addresses a defect in current functionality. and removed needs-triage Waiting for first response or review from a maintainer. labels Feb 29, 2024
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 TESTARGS='-run=TestAccRedshiftServerlessWorkgroup_' PKG=redshiftserverless ACCTEST_PARALLELISM=3
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/redshiftserverless/... -v -count 1 -parallel 3  -run=TestAccRedshiftServerlessWorkgroup_ -timeout 360m
=== RUN   TestAccRedshiftServerlessWorkgroup_basic
=== PAUSE TestAccRedshiftServerlessWorkgroup_basic
=== RUN   TestAccRedshiftServerlessWorkgroup_baseAndMaxCapacityAndPubliclyAccessible
=== PAUSE TestAccRedshiftServerlessWorkgroup_baseAndMaxCapacityAndPubliclyAccessible
=== RUN   TestAccRedshiftServerlessWorkgroup_configParameters
=== PAUSE TestAccRedshiftServerlessWorkgroup_configParameters
=== RUN   TestAccRedshiftServerlessWorkgroup_tags
=== PAUSE TestAccRedshiftServerlessWorkgroup_tags
=== RUN   TestAccRedshiftServerlessWorkgroup_disappears
=== PAUSE TestAccRedshiftServerlessWorkgroup_disappears
=== RUN   TestAccRedshiftServerlessWorkgroup_port
=== PAUSE TestAccRedshiftServerlessWorkgroup_port
=== CONT  TestAccRedshiftServerlessWorkgroup_basic
=== CONT  TestAccRedshiftServerlessWorkgroup_tags
=== CONT  TestAccRedshiftServerlessWorkgroup_configParameters
--- PASS: TestAccRedshiftServerlessWorkgroup_basic (248.60s)
=== CONT  TestAccRedshiftServerlessWorkgroup_baseAndMaxCapacityAndPubliclyAccessible
--- PASS: TestAccRedshiftServerlessWorkgroup_tags (283.02s)
=== CONT  TestAccRedshiftServerlessWorkgroup_port
--- PASS: TestAccRedshiftServerlessWorkgroup_configParameters (356.22s)
=== CONT  TestAccRedshiftServerlessWorkgroup_disappears
--- PASS: TestAccRedshiftServerlessWorkgroup_port (253.62s)
--- PASS: TestAccRedshiftServerlessWorkgroup_disappears (291.94s)
--- PASS: TestAccRedshiftServerlessWorkgroup_baseAndMaxCapacityAndPubliclyAccessible (1175.57s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/redshiftserverless	1431.231s

@ewbankkit
Copy link
Contributor

@marcinbelczewski Thanks for the contribution 🎉 👏.

@ewbankkit ewbankkit merged commit 7db5ffa into hashicorp:main Feb 29, 2024
36 checks passed
@github-actions github-actions bot added this to the v5.39.0 milestone Feb 29, 2024
Copy link

github-actions bot commented Mar 1, 2024

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

Copy link

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 Mar 31, 2024
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/redshiftserverless Issues and PRs that pertain to the redshiftserverless service. size/L 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
2 participants