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

Fix RDS instance bug where switching to IO2 from GP needs the allocated storage set #37257

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

nhenjes
Copy link

@nhenjes nhenjes commented May 3, 2024

Description

When creating an RDS instance, the Allocated Storage param is passed correctly to AWS. When going from, for example, GP3 to IO2 on an existing instance only a change in the Storage Type is detected by the provider and only Storage Type is passed. AWS' API however, requires that both storage type and Allocated Storage are submitted as part of the request

Relations

Closes #36648

References

When running aws rds modify-db-instance --db-instance-identifier <db-name> --storage-type io2 --iops 3000 the following error is thrown

An error occurred (InvalidParameterCombination) when calling the ModifyDBInstance operation: You must specify both the storage size and iops when modifying the storage size or iops on a DB instance that has iops.

When running aws rds modify-db-instance --db-instance-identifier <db-name> --storage-type io2 --iops 3000 --allocated-storage 100

The result is a successful change

Subsequent runs with the same params result in success meaning passing the allocated storage again is perfectly fine

Output from Acceptance Testing

==> Checking that code complies with gofmt requirements...
TF_ACC=1 go1.22.2 test ./internal/service/rds/... -v -count 1 -parallel 20 -run='TestAccRDSCluster_storageTypeGeneralPurposeToProvisionedIops'  -timeout 360m
=== RUN   TestAccRDSCluster_storageTypeGeneralPurposeToProvisionedIops
=== PAUSE TestAccRDSCluster_storageTypeGeneralPurposeToProvisionedIops
=== CONT  TestAccRDSCluster_storageTypeGeneralPurposeToProvisionedIops
--- PASS: TestAccRDSCluster_storageTypeGeneralPurposeToProvisionedIops (970.05s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/rds	976.063s

Copy link

github-actions bot commented May 3, 2024

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/XS Managed by automation to categorize the size of a PR. service/rds Issues and PRs that pertain to the rds service. and removed size/XS Managed by automation to categorize the size of a PR. labels May 3, 2024
@terraform-aws-provider terraform-aws-provider bot added the needs-triage Waiting for first response or review from a maintainer. label May 3, 2024
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Welcome @nhenjes 👋

It looks like this is your first Pull Request submission to the Terraform AWS Provider! If you haven’t already done so please make sure you have checked out our CONTRIBUTOR guide and FAQ to make sure your contribution is adhering to best practice and has all the necessary elements in place for a successful approval.

Also take a look at our FAQ which details how we prioritize Pull Requests for inclusion.

Thanks again, and welcome to the community! 😃

@github-actions github-actions bot added the size/XS Managed by automation to categorize the size of a PR. label May 3, 2024
@nhenjes nhenjes marked this pull request as ready for review May 3, 2024 15:59
@justinretzolk justinretzolk added bug Addresses a defect in current functionality. and removed needs-triage Waiting for first response or review from a maintainer. labels May 3, 2024
@nhenjes nhenjes changed the title Fix RDS instance bug where switching to IO2 needs the allocated stora… Fix RDS instance bug where switching to IO2 from GP needs the allocated storage set May 3, 2024
@DrFaust92
Copy link
Collaborator

nhenjes Thank you for your contribution, can you also add a test for this?

@nhenjes
Copy link
Author

nhenjes commented May 13, 2024

@DrFaust92 I can work on writing a test for this

@github-actions github-actions bot added size/S Managed by automation to categorize the size of a PR. size/XS Managed by automation to categorize the size of a PR. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. and removed size/XS Managed by automation to categorize the size of a PR. size/S Managed by automation to categorize the size of a PR. labels May 17, 2024
@nhenjes nhenjes force-pushed the b-aws_rds_instance-storage-change-fix-36648 branch 2 times, most recently from 2509a7f to 77375f7 Compare May 17, 2024 14:30
@github-actions github-actions bot added size/M Managed by automation to categorize the size of a PR. and removed size/XS Managed by automation to categorize the size of a PR. labels May 17, 2024
@nhenjes
Copy link
Author

nhenjes commented May 17, 2024

@DrFaust92 I was able to get my test working properly now. The test will provision a cluster using GP3 at 400GB with 12000 provisioned IOPs then updates to IO2 successfully.

Without the bug fix, the same test reports

        Error: updating RDS DB Instance (terraform-20240517150000387300000001): operation error RDS: ModifyDBInstance, https response error StatusCode: 400, RequestID: b15c2fa4-e202-4778-a85f-09f34ce77dcc, api error InvalidParameterCombination: You must specify both the storage size and iops when modifying the storage size or iops on a DB instance that has iops.
        
          with aws_db_instance.test,
          on terraform_plugin_test.tf line 56, in resource "aws_db_instance" "test":
          56: resource "aws_db_instance" "test" {

@nhenjes nhenjes force-pushed the b-aws_rds_instance-storage-change-fix-36648 branch from 77375f7 to 7109377 Compare May 17, 2024 20:34
@nhenjes nhenjes force-pushed the b-aws_rds_instance-storage-change-fix-36648 branch from 7109377 to 2ca05fd Compare May 17, 2024 20:37
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. service/rds Issues and PRs that pertain to the rds service. size/M 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]: Changing to IO2 storage on RDS instance fails
3 participants