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

Allow Aurora Serverless scaling to zero capacity. #40230

Conversation

ohookins
Copy link
Contributor

@ohookins ohookins commented Nov 21, 2024

Description

https://aws.amazon.com/blogs/database/introducing-scaling-to-0-capacity-with-amazon-aurora-serverless-v2

Aurora Serverless now supports scaling to 0 (previously the minimum was 0.5). There are some additional checks around specific versions of the engine (e.g. PostgreSQL versions) but these are likely to change reasonably frequently and may not be wise to encode in the provider. API checks at runtime will error out if an incompatible engine version is selected.

Relations

Closes #40226.
Closes #40427.
Closes #40421.

References

https://aws.amazon.com/blogs/database/introducing-scaling-to-0-capacity-with-amazon-aurora-serverless-v2

Output from Acceptance Testing

make testacc TESTS=TestAccRDSCluster_serverlessV2ScalingConfiguration PKG=rds
make: Verifying source code with gofmt...
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go1.23.2 test ./internal/service/rds/... -v -count 1 -parallel 20 -run='TestAccRDSCluster_serverlessV2ScalingConfiguration'  -timeout 360m
2024/11/21 18:42:49 Initializing Terraform AWS Provider...
=== RUN   TestAccRDSCluster_serverlessV2ScalingConfiguration
=== PAUSE TestAccRDSCluster_serverlessV2ScalingConfiguration
=== CONT  TestAccRDSCluster_serverlessV2ScalingConfiguration
    cluster_test.go:1948: Error running post-test destroy, there may be dangling resources: exit status 1

        Error: Invalid provider configuration

        Provider "registry.terraform.io/hashicorp/aws" requires explicit
        configuration. Add a provider block to the root module and configure the
        provider's required arguments as described in the provider documentation.


        Error: unable to add custom RootCAs HTTPClient, has no WithTransportOptions, *http.Client

          with provider["registry.terraform.io/hashicorp/aws"],
          on <empty> line 0:
          (source code not available)

--- FAIL: TestAccRDSCluster_serverlessV2ScalingConfiguration (184.60s)
FAIL
FAIL	github.com/hashicorp/terraform-provider-aws/internal/service/rds	189.981s
FAIL
make: *** [testacc] Error 1

Not quite sure what's going on here, it doesn't seem related to the change since it happens on the main branch as well. I checked the debug logs and the clusters are created properly, it just doesn't seem to clean up after a provider credential change 🤔

@ohookins ohookins requested a review from a team as a code owner November 21, 2024 07:08
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 tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. service/rds Issues and PRs that pertain to the rds service. needs-triage Waiting for first response or review from a maintainer. labels Nov 21, 2024
@geshan
Copy link

geshan commented Nov 25, 2024

+1

@fatbasstard
Copy link
Contributor

fatbasstard commented Nov 27, 2024

Nice, this enables the scale back to 0 for serverless v2

It is posssible to add the seconds_until_auto_pause attribute, this makes it actually configurable (default is 300 seconds)

@ViktorCollin
Copy link
Contributor

ViktorCollin commented Dec 3, 2024

This PR should add the seconds_until_auto_pause parameter to the existing PR

@garym-krrv
Copy link

Documentation should be updated too but + for the PR

@ewbankkit ewbankkit added enhancement Requests to existing resources that expand the functionality or scope. and removed needs-triage Waiting for first response or review from a maintainer. labels Dec 4, 2024
@ewbankkit ewbankkit self-assigned this Dec 4, 2024
@github-actions github-actions bot added the prioritized Part of the maintainer teams immediate focus. To be addressed within the current quarter. label Dec 4, 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=TestAccRDSCluster_serverlessV2ScalingConfiguration\|TestAccRDSCluster_enableHTTPEndpointProvisioned\|TestAccRDSCluster_engineMode' PKG=rds
make: Verifying source code with gofmt...
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go1.23.3 test ./internal/service/rds/... -v -count 1 -parallel 20  -run=TestAccRDSCluster_serverlessV2ScalingConfiguration\|TestAccRDSCluster_enableHTTPEndpointProvisioned\|TestAccRDSCluster_engineMode -timeout 360m
2024/12/04 09:04:40 Initializing Terraform AWS Provider...
=== RUN   TestAccRDSCluster_engineMode
=== PAUSE TestAccRDSCluster_engineMode
=== RUN   TestAccRDSCluster_serverlessV2ScalingConfiguration
=== PAUSE TestAccRDSCluster_serverlessV2ScalingConfiguration
=== RUN   TestAccRDSCluster_enableHTTPEndpointProvisioned
=== PAUSE TestAccRDSCluster_enableHTTPEndpointProvisioned
=== CONT  TestAccRDSCluster_engineMode
=== CONT  TestAccRDSCluster_enableHTTPEndpointProvisioned
=== CONT  TestAccRDSCluster_serverlessV2ScalingConfiguration
--- PASS: TestAccRDSCluster_serverlessV2ScalingConfiguration (174.19s)
--- PASS: TestAccRDSCluster_enableHTTPEndpointProvisioned (190.18s)
--- PASS: TestAccRDSCluster_engineMode (386.20s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/rds	391.747s

Copy link
Member

@jar-b jar-b left a comment

Choose a reason for hiding this comment

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

LGTM 🚀

@ewbankkit
Copy link
Contributor

@ohookins Thanks for the contribution 🎉 👏.

@ewbankkit ewbankkit merged commit 33689a1 into hashicorp:main Dec 4, 2024
42 checks passed
@github-actions github-actions bot added this to the v5.80.0 milestone Dec 4, 2024
@github-actions github-actions bot removed the prioritized Part of the maintainer teams immediate focus. To be addressed within the current quarter. label Dec 4, 2024
Copy link

github-actions bot commented Dec 4, 2024

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

@ohookins ohookins deleted the 40226-zero-capacity-aurora-serverless-scaling branch December 4, 2024 23:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Requests to existing resources that expand the functionality or scope. service/rds Issues and PRs that pertain to the rds service. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure.
Projects
None yet
7 participants