-
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
aws_rds_cluster
: Fix Regression in serverlessv2_scaling_configuration
Handling
#40511
Conversation
Community NoteVoting for Prioritization
For Submitters
|
aws_rds_cluster
: Fix Regression in serverlessv2_scaling_configuration
Handling
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=TestAccRDSCluster_serverlessV2Scaling' 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_serverlessV2Scaling -timeout 360m
2024/12/10 17:13:57 Initializing Terraform AWS Provider...
=== RUN TestAccRDSCluster_serverlessV2ScalingConfiguration
=== PAUSE TestAccRDSCluster_serverlessV2ScalingConfiguration
=== RUN TestAccRDSCluster_serverlessV2ScalingRemoved
=== PAUSE TestAccRDSCluster_serverlessV2ScalingRemoved
=== CONT TestAccRDSCluster_serverlessV2ScalingConfiguration
=== CONT TestAccRDSCluster_serverlessV2ScalingRemoved
--- PASS: TestAccRDSCluster_serverlessV2ScalingRemoved (192.95s)
--- PASS: TestAccRDSCluster_serverlessV2ScalingConfiguration (250.56s)
PASS
ok github.com/hashicorp/terraform-provider-aws/internal/service/rds 256.109s
This functionality has been released in v5.81.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 PR addresses a breaking regression introduced in v5.80.0 that affects the removal of the
serverlessv2_scaling_configuration
block in RDS cluster configurations.Problem
Prior to v5.80.0, users could remove the
serverlessv2_scaling_configuration
block from their configuration without errors or perpetual diffs. While AWS does not remove the scaling configuration metadata when the block is deleted, Terraform allowed users to remove the block without errors.However, v5.80.0 and #40230 introduced two issues:
max_capacity
could be explicitly set to0
, an invalid value for AWS.max_capacity: 0
to the AWS API when theserverlessv2_scaling_configuration
block was removed, causing the error:InvalidParameterValue: Serverless v2 maximum capacity 0.0 isn't valid. The maximum capacity must be at least 1.0.
These issues occurred because removing the block caused Terraform to default all arguments to
0
, includingmax_capacity
, which was then sent to the AWS API.Steps to Reproduce
serverlessv2_scaling_configuration
block.serverlessv2_scaling_configuration
block from the configuration.On v5.79.0 and earlier, this succeeded. On v5.80.0 and later, it fails due to the invalid
max_capacity: 0
error.Solution
This PR resolves the regression with the following changes:
max_capacity
from being explicitly set to0
.max_capacity
is not sent to the AWS API when its value is0
, such as when theserverlessv2_scaling_configuration
block is removed.Additionally, to restore compatibility with behavior prior to v5.80.0, this PR suppresses diffs caused by the removal of the
serverlessv2_scaling_configuration
block. AWS does not allow updating a cluster to remove its serverless v2 scaling configuration once it has been set, even if the cluster no longer uses the configuration or serverless instances. Suppressing these diffs ensures users can manage their configurations without encountering perpetual mismatches between Terraform and the infrastructure state.Impact
This PR restores the expected behavior from v5.79.0 and earlier, allowing users to remove the
serverlessv2_scaling_configuration
block from their configurations without errors or unnecessary diffs, while ensuring invalid values are not sent to the AWS API.Relations
Closes #40473
Relates to changes made in #40230
References
Output from Acceptance Testing