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

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .changelog/40230.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
resource/aws_rds_cluster: Adjust `serverlessv2_scaling_configuration.max_capacity` and `serverlessv2_scaling_configuration.min_capacity` minimum values to `0` to support Amazon Aurora Serverless v2 scaling to 0 ACUs
```
8 changes: 4 additions & 4 deletions internal/service/rds/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -547,12 +547,12 @@ func resourceCluster() *schema.Resource {
names.AttrMaxCapacity: {
Type: schema.TypeFloat,
Required: true,
ValidateFunc: validation.FloatBetween(0.5, 256),
ValidateFunc: validation.FloatBetween(0, 256),
},
"min_capacity": {
Type: schema.TypeFloat,
Required: true,
ValidateFunc: validation.FloatBetween(0.5, 256),
ValidateFunc: validation.FloatBetween(0, 256),
},
},
},
Expand Down Expand Up @@ -2136,11 +2136,11 @@ func expandServerlessV2ScalingConfiguration(tfMap map[string]interface{}) *types

apiObject := &types.ServerlessV2ScalingConfiguration{}

if v, ok := tfMap[names.AttrMaxCapacity].(float64); ok && v != 0.0 {
if v, ok := tfMap[names.AttrMaxCapacity].(float64); ok {
apiObject.MaxCapacity = aws.Float64(v)
}

if v, ok := tfMap["min_capacity"].(float64); ok && v != 0.0 {
if v, ok := tfMap["min_capacity"].(float64); ok {
apiObject.MinCapacity = aws.Float64(v)
}

Expand Down
8 changes: 4 additions & 4 deletions internal/service/rds/cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2068,21 +2068,21 @@ func TestAccRDSCluster_serverlessV2ScalingConfiguration(t *testing.T) {
CheckDestroy: testAccCheckClusterDestroy(ctx),
Steps: []resource.TestStep{
{
Config: testAccClusterConfig_serverlessV2ScalingConfiguration(rName, 64.0, 0.5),
Config: testAccClusterConfig_serverlessV2ScalingConfiguration(rName, 64.0, 2.5),
Check: resource.ComposeTestCheckFunc(
testAccCheckClusterExists(ctx, resourceName, &dbCluster),
resource.TestCheckResourceAttr(resourceName, "serverlessv2_scaling_configuration.#", "1"),
resource.TestCheckResourceAttr(resourceName, "serverlessv2_scaling_configuration.0.max_capacity", "64"),
resource.TestCheckResourceAttr(resourceName, "serverlessv2_scaling_configuration.0.min_capacity", "0.5"),
resource.TestCheckResourceAttr(resourceName, "serverlessv2_scaling_configuration.0.min_capacity", "2.5"),
),
},
{
Config: testAccClusterConfig_serverlessV2ScalingConfiguration(rName, 256.0, 8.5),
Config: testAccClusterConfig_serverlessV2ScalingConfiguration(rName, 256.0, 0),
Check: resource.ComposeTestCheckFunc(
testAccCheckClusterExists(ctx, resourceName, &dbCluster),
resource.TestCheckResourceAttr(resourceName, "serverlessv2_scaling_configuration.#", "1"),
resource.TestCheckResourceAttr(resourceName, "serverlessv2_scaling_configuration.0.max_capacity", "256"),
resource.TestCheckResourceAttr(resourceName, "serverlessv2_scaling_configuration.0.min_capacity", "8.5"),
resource.TestCheckResourceAttr(resourceName, "serverlessv2_scaling_configuration.0.min_capacity", "0"),
),
},
},
Expand Down
4 changes: 2 additions & 2 deletions website/docs/r/rds_cluster.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -366,8 +366,8 @@ resource "aws_rds_cluster" "example" {
}
```

* `max_capacity` - (Required) Maximum capacity for an Aurora DB cluster in `provisioned` DB engine mode. The maximum capacity must be greater than or equal to the minimum capacity. Valid capacity values are in a range of `0.5` up to `256` in steps of `0.5`.
* `min_capacity` - (Required) Minimum capacity for an Aurora DB cluster in `provisioned` DB engine mode. The minimum capacity must be lesser than or equal to the maximum capacity. Valid capacity values are in a range of `0.5` up to `256` in steps of `0.5`.
* `max_capacity` - (Required) Maximum capacity for an Aurora DB cluster in `provisioned` DB engine mode. The maximum capacity must be greater than or equal to the minimum capacity. Valid capacity values are in a range of `0` up to `256` in steps of `0.5`.
* `min_capacity` - (Required) Minimum capacity for an Aurora DB cluster in `provisioned` DB engine mode. The minimum capacity must be lesser than or equal to the maximum capacity. Valid capacity values are in a range of `0` up to `256` in steps of `0.5`.

## Attribute Reference

Expand Down
Loading