Skip to content

fix: aws_rds_cluster storage_type change cases replacement - #49209

Open
corymhall wants to merge 2 commits into
hashicorp:mainfrom
corymhall:fix/rds-cluster-storage-type-replace
Open

fix: aws_rds_cluster storage_type change cases replacement#49209
corymhall wants to merge 2 commits into
hashicorp:mainfrom
corymhall:fix/rds-cluster-storage-type-replace

Conversation

@corymhall

Copy link
Copy Markdown
Contributor

Rollback Plan

If a change needs to be reverted, we will publish an updated version of the library.

Changes to Security Controls

None

Description

Changing storage_type on a non-Aurora Multi-AZ RDS cluster forced a replacement even though AWS supports the change through ModifyDBCluster.

This PR removes that replacement condition. In addition, when you update the storage_type AWS also makes you send the AllocatedStorage and the Iops values along with the new storage_type.

One special case is when you change from io2 => gp3 and the allocated storage is below 400 AWS does not allow you to send an Iops value. We handle this by making sure we send a null value instead of the 0 value.

Relations

Closes #48438

References

This is built on top of #48545 and adds the additional tests and handling of AllocatedStorage and Iops.

Output from Acceptance Testing

% make testacc TESTS=TestAccRDSCluster_storageType PKG=rds

2026/07/30 07:05:01 Creating Terraform AWS Provider (SDKv2-style)...
2026/07/30 07:05:01 Initializing Terraform AWS Provider (SDKv2-style)...
=== RUN   TestAccRDSCluster_storageTypeUpdateNonAurora_io2ToGP3WithoutIOPS
=== PAUSE TestAccRDSCluster_storageTypeUpdateNonAurora_io2ToGP3WithoutIOPS
=== CONT  TestAccRDSCluster_storageTypeUpdateNonAurora_io2ToGP3WithoutIOPS
--- PASS: TestAccRDSCluster_storageTypeUpdateNonAurora_io2ToGP3WithoutIOPS (2447.65s)
PASS
ok      github.com/hashicorp/terraform-provider-aws/internal/service/rds        2453.446s

2026/07/29 15:01:57 Creating Terraform AWS Provider (SDKv2-style)...
2026/07/29 15:01:57 Initializing Terraform AWS Provider (SDKv2-style)...
=== RUN   TestAccRDSCluster_storageTypeAuroraUpdateAuroraIopt1
=== PAUSE TestAccRDSCluster_storageTypeAuroraUpdateAuroraIopt1
=== RUN   TestAccRDSCluster_storageTypeAuroraIopt1UpdateAurora
=== PAUSE TestAccRDSCluster_storageTypeAuroraIopt1UpdateAurora
=== CONT  TestAccRDSCluster_storageTypeAuroraUpdateAuroraIopt1
=== CONT  TestAccRDSCluster_storageTypeAuroraIopt1UpdateAurora
--- PASS: TestAccRDSCluster_storageTypeAuroraIopt1UpdateAurora (127.41s)
--- PASS: TestAccRDSCluster_storageTypeAuroraUpdateAuroraIopt1 (137.86s)
PASS
ok      github.com/hashicorp/terraform-provider-aws/internal/service/rds        143.819s

2026/07/29 12:55:14 Creating Terraform AWS Provider (SDKv2-style)...
2026/07/29 12:55:14 Initializing Terraform AWS Provider (SDKv2-style)...
=== RUN   TestAccRDSCluster_storageTypeUpdateNonAurora_gp3ToIO2WithDifferentIOPS
=== PAUSE TestAccRDSCluster_storageTypeUpdateNonAurora_gp3ToIO2WithDifferentIOPS
=== RUN   TestAccRDSCluster_storageTypeUpdateNonAurora_io1ToIO2WithSameIOPS
=== PAUSE TestAccRDSCluster_storageTypeUpdateNonAurora_io1ToIO2WithSameIOPS
=== RUN   TestAccRDSCluster_storageTypeUpdateNonAurora_io2ToGP3WithDifferentIOPS
=== PAUSE TestAccRDSCluster_storageTypeUpdateNonAurora_io2ToGP3WithDifferentIOPS
=== CONT  TestAccRDSCluster_storageTypeUpdateNonAurora_gp3ToIO2WithDifferentIOPS
=== CONT  TestAccRDSCluster_storageTypeUpdateNonAurora_io2ToGP3WithDifferentIOPS
=== CONT  TestAccRDSCluster_storageTypeUpdateNonAurora_io1ToIO2WithSameIOPS
--- PASS: TestAccRDSCluster_storageTypeUpdateNonAurora_io2ToGP3WithDifferentIOPS (2295.89s)
--- PASS: TestAccRDSCluster_storageTypeUpdateNonAurora_gp3ToIO2WithDifferentIOPS (2302.79s)
--- PASS: TestAccRDSCluster_storageTypeUpdateNonAurora_io1ToIO2WithSameIOPS (2372.21s)
PASS
ok      github.com/hashicorp/terraform-provider-aws/internal/service/rds        2378.361s

Changing `storage_type` on a non-Aurora Multi-AZ RDS cluster forced a replacement even though AWS supports the change through `ModifyDBCluster`.

This PR removes that replacement condition. In addition, when you update
the storage_type AWS also makes you send the `AllocatedStorage` and the
`Iops` values along with the new `storage_type`.

One special case is when you change from `io2` => `gp3` and the
allocated storage is below `400` AWS does not allow you to send an Iops
value. We handle this by making sure we send a null value instead of the
0 value.

fixes hashicorp#48438

**Output from Acceptance Testing**

```
2026/07/30 07:05:01 Creating Terraform AWS Provider (SDKv2-style)...
2026/07/30 07:05:01 Initializing Terraform AWS Provider (SDKv2-style)...
=== RUN   TestAccRDSCluster_storageTypeUpdateNonAurora_io2ToGP3WithoutIOPS
=== PAUSE TestAccRDSCluster_storageTypeUpdateNonAurora_io2ToGP3WithoutIOPS
=== CONT  TestAccRDSCluster_storageTypeUpdateNonAurora_io2ToGP3WithoutIOPS
--- PASS: TestAccRDSCluster_storageTypeUpdateNonAurora_io2ToGP3WithoutIOPS (2447.65s)
PASS
ok      github.com/hashicorp/terraform-provider-aws/internal/service/rds        2453.446s

2026/07/29 15:01:57 Creating Terraform AWS Provider (SDKv2-style)...
2026/07/29 15:01:57 Initializing Terraform AWS Provider (SDKv2-style)...
=== RUN   TestAccRDSCluster_storageTypeAuroraUpdateAuroraIopt1
=== PAUSE TestAccRDSCluster_storageTypeAuroraUpdateAuroraIopt1
=== RUN   TestAccRDSCluster_storageTypeAuroraIopt1UpdateAurora
=== PAUSE TestAccRDSCluster_storageTypeAuroraIopt1UpdateAurora
=== CONT  TestAccRDSCluster_storageTypeAuroraUpdateAuroraIopt1
=== CONT  TestAccRDSCluster_storageTypeAuroraIopt1UpdateAurora
--- PASS: TestAccRDSCluster_storageTypeAuroraIopt1UpdateAurora (127.41s)
--- PASS: TestAccRDSCluster_storageTypeAuroraUpdateAuroraIopt1 (137.86s)
PASS
ok      github.com/hashicorp/terraform-provider-aws/internal/service/rds        143.819s

2026/07/29 12:55:14 Creating Terraform AWS Provider (SDKv2-style)...
2026/07/29 12:55:14 Initializing Terraform AWS Provider (SDKv2-style)...
=== RUN   TestAccRDSCluster_storageTypeUpdateNonAurora_gp3ToIO2WithDifferentIOPS
=== PAUSE TestAccRDSCluster_storageTypeUpdateNonAurora_gp3ToIO2WithDifferentIOPS
=== RUN   TestAccRDSCluster_storageTypeUpdateNonAurora_io1ToIO2WithSameIOPS
=== PAUSE TestAccRDSCluster_storageTypeUpdateNonAurora_io1ToIO2WithSameIOPS
=== RUN   TestAccRDSCluster_storageTypeUpdateNonAurora_io2ToGP3WithDifferentIOPS
=== PAUSE TestAccRDSCluster_storageTypeUpdateNonAurora_io2ToGP3WithDifferentIOPS
=== CONT  TestAccRDSCluster_storageTypeUpdateNonAurora_gp3ToIO2WithDifferentIOPS
=== CONT  TestAccRDSCluster_storageTypeUpdateNonAurora_io2ToGP3WithDifferentIOPS
=== CONT  TestAccRDSCluster_storageTypeUpdateNonAurora_io1ToIO2WithSameIOPS
--- PASS: TestAccRDSCluster_storageTypeUpdateNonAurora_io2ToGP3WithDifferentIOPS (2295.89s)
--- PASS: TestAccRDSCluster_storageTypeUpdateNonAurora_gp3ToIO2WithDifferentIOPS (2302.79s)
--- PASS: TestAccRDSCluster_storageTypeUpdateNonAurora_io1ToIO2WithSameIOPS (2372.21s)
PASS
ok      github.com/hashicorp/terraform-provider-aws/internal/service/rds        2378.361s
```
@corymhall
corymhall requested a review from a team as a code owner July 30, 2026 16:46
@dosubot dosubot Bot added the bug Addresses a defect in current functionality. label Jul 30, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Community Guidelines

This comment is added to every new Pull Request to provide quick reference to how the Terraform AWS Provider is maintained. Please review the information below, and thank you for contributing to the community that keeps the provider thriving! 🚀

Voting for Prioritization

  • Please vote on this Pull Request by adding a 👍 reaction to the original post to help the community and maintainers prioritize it.
  • Please see our prioritization guide for additional information on how the maintainers handle prioritization.
  • Please do not leave +1 or other comments that do not add relevant new information or questions; they generate extra noise for others following the Pull Request and do not help prioritize the request.

Pull Request Authors

  • Review the contribution guide relating to the type of change you are making to ensure all of the necessary steps have been taken.
  • 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 commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

✅ Thank you for correcting the previously detected issues! The maintainers appreciate your efforts to make the review process as smooth as possible.

@github-actions github-actions Bot added needs-triage Waiting for first response or review from a maintainer. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. service/rds Issues and PRs that pertain to the rds service. size/L Managed by automation to categorize the size of a PR. labels Jul 30, 2026
corymhall added a commit to pulumi/pulumi-aws that referenced this pull request Jul 30, 2026
## Problem

Changing `storage_type` on a non-Aurora Multi-AZ RDS cluster forced a
replacement even though AWS supports the change through
`ModifyDBCluster`. Removing that replacement condition alone is
insufficient because AWS requires the current allocation and IOPS when
changing to provisioned IOPS storage or configurable gp3.

## Solution

- Carry
[hashicorp/terraform-provider-aws#49209](hashicorp/terraform-provider-aws#49209)
as patch `0030` to remove the dynamic replacement while preserving
Aurora's existing `aurora` normalization.
- Send `AllocatedStorage` and `Iops` when the target storage type
requires them; omit removed IOPS when changing to gp3 below its
configurable threshold.
- Add a cached Pulumi provider-upgrade preview from v7.39.0 that asserts
the transition produces an update and no replacement.

The existing gp3 default-IOPS drift below 400 GiB remains tracked by
hashicorp/terraform-provider-aws#41203.

## Validation

- `./scripts/upstream.sh check_in`
- Live non-Aurora acceptance matrix: io2→gp3 without IOPS, gp3→io2,
io1→io2, and io2→gp3 with changed IOPS
- Live Aurora compatibility tests for `aurora` ↔ `aurora-iopt1`
- `make provider`
- `make test_provider`
- `TestRegressRDSClusterStorageTypeUpdateNonAurora`: v7.39.0 recording
and cached replay

Fixes #6554

---------

Co-authored-by: corymhall <43035978+corymhall@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Addresses a defect in current functionality. needs-triage Waiting for first response or review from a maintainer. service/rds Issues and PRs that pertain to the rds 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

Development

Successfully merging this pull request may close these issues.

[Bug]: aws_rds_cluster change in storage_type causes forced replacement

1 participant