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

Merged

Conversation

nhenjes
Copy link
Contributor

@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.
Relates (closes?) #28589.

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
Contributor 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
Contributor 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
@YakDriver YakDriver self-assigned this Nov 22, 2024
@github-actions github-actions bot added the prioritized Part of the maintainer teams immediate focus. To be addressed within the current quarter. label Nov 22, 2024
@YakDriver YakDriver requested a review from a team as a code owner November 22, 2024 15:07
Copy link
Member

@YakDriver YakDriver left a comment

Choose a reason for hiding this comment

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

Looks good 🎉

% make t T=TestAccRDSCluster_storageTypeGeneralPurposeToProvisionedIops K=rds
make: go1.23.3 not found
make: installing go1.23.3...
make: if you get an error, see https://go.dev/doc/manage-install to locally install various Go versions
go: downloading golang.org/dl v0.0.0-20241106222207-4e0968199959
Downloaded   0.0% (   16384 / 71639942 bytes) ...
Downloaded  17.8% (12763072 / 71639942 bytes) ...
Downloaded 100.0% (71639942 / 71639942 bytes)
Unpacking /Users/dirk/sdk/go1.23.3/go1.23.3.darwin-arm64.tar.gz ...
Success. You may now run 'go1.23.3'
make: go1.23.3 ready
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_storageTypeGeneralPurposeToProvisionedIops'  -timeout 360m
go: downloading github.com/aws/aws-sdk-go-v2/service/apigateway v1.28.0
go: downloading github.com/aws/aws-sdk-go-v2/service/applicationautoscaling v1.34.0
go: downloading github.com/aws/aws-sdk-go-v2/service/appsync v1.40.0
go: downloading github.com/aws/aws-sdk-go-v2/service/cloudfront v1.43.0
go: downloading github.com/aws/aws-sdk-go-v2/service/cloudtrail v1.46.0
go: downloading github.com/aws/aws-sdk-go-v2/service/cloudwatchlogs v1.44.0
go: downloading github.com/aws/aws-sdk-go-v2/service/costexplorer v1.44.0
go: downloading github.com/aws/aws-sdk-go-v2/service/dlm v1.28.7
go: downloading github.com/aws/aws-sdk-go-v2/service/ec2 v1.193.0
go: downloading github.com/aws/aws-sdk-go-v2/service/elasticache v1.44.0
go: downloading github.com/aws/aws-sdk-go-v2/service/elasticloadbalancingv2 v1.42.1
go: downloading github.com/aws/aws-sdk-go-v2/service/iot v1.61.0
go: downloading github.com/aws/aws-sdk-go-v2/service/lambda v1.68.0
go: downloading github.com/aws/aws-sdk-go-v2/service/polly v1.45.7
go: downloading github.com/aws/aws-sdk-go-v2/service/resiliencehub v1.28.0
go: downloading github.com/aws/aws-sdk-go-v2/service/s3 v1.68.0
go: downloading github.com/aws/aws-sdk-go-v2/service/ssm v1.56.0
go: downloading github.com/aws/aws-sdk-go-v2/service/ssmquicksetup v1.3.0
go: downloading github.com/aws/aws-sdk-go-v2/service/xray v1.30.0
go: downloading github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.17.40
2024/11/22 09:58:11 Initializing Terraform AWS Provider...
=== RUN   TestAccRDSCluster_storageTypeGeneralPurposeToProvisionedIops
=== PAUSE TestAccRDSCluster_storageTypeGeneralPurposeToProvisionedIops
=== CONT  TestAccRDSCluster_storageTypeGeneralPurposeToProvisionedIops
--- PASS: TestAccRDSCluster_storageTypeGeneralPurposeToProvisionedIops (1084.15s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/rds	1088.267s

@YakDriver YakDriver enabled auto-merge November 22, 2024 15:20
Copy link
Contributor

@johnsonaj johnsonaj left a comment

Choose a reason for hiding this comment

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

LGTM 🚀

@YakDriver YakDriver merged commit 2d557a8 into hashicorp:main Nov 22, 2024
32 of 33 checks passed
@github-actions github-actions bot added this to the v5.78.0 milestone Nov 22, 2024
@ewbankkit ewbankkit mentioned this pull request Nov 22, 2024
@github-actions github-actions bot removed the prioritized Part of the maintainer teams immediate focus. To be addressed within the current quarter. label Nov 26, 2024
Copy link

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

Copy link

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 27, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
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
5 participants