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

b/resource_aws_rds_cluster: RDS cluster port change to happen in-place #18081

Merged
merged 6 commits into from
Apr 13, 2021
Merged

b/resource_aws_rds_cluster: RDS cluster port change to happen in-place #18081

merged 6 commits into from
Apr 13, 2021

Conversation

thisdougb
Copy link
Contributor

@thisdougb thisdougb commented Mar 13, 2021

Community Note

  • Please vote on this pull request by adding a 👍 reaction to the original pull request comment to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for pull request followers and do not help prioritize the request

Closes #18061

Problem

When changing the RDS cluster port, currently this causes a recreate. This should be an in-place change.

Fix

  • removes ForceNew from Port in schema
  • requests cluster update if port config has changed
  • modifies the particular test method to no longer check for ClusterRecreated.

Testing

Output from acceptance testing:

$ make testacc TESTARGS='-run=TestAccAWSRDSCluster_Port'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -count 1 -parallel 20 -run=TestAccAWSRDSCluster_Port -timeout 180m
=== RUN   TestAccAWSRDSCluster_Port
=== PAUSE TestAccAWSRDSCluster_Port
=== CONT  TestAccAWSRDSCluster_Port
--- PASS: TestAccAWSRDSCluster_Port (284.74s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	289.250s

Output from my test env:

$ terraform apply

Warning: Provider development overrides are in effect

The following provider development overrides are set in the CLI configuration:
 - hashicorp/aws in /Users/dougb/dev/Go/src/github.com/scratch/aurora-test/terraform/tf-provider

aws_vpc.demo_vpc: Refreshing state... [id=vpc-093705f903f600b11]
aws_subnet.public[0]: Refreshing state... [id=subnet-004c69ce044e18d39]
aws_subnet.public[1]: Refreshing state... [id=subnet-0691d19de97719833]
aws_db_subnet_group.aurora_subnet_group: Refreshing state... [id=aurora_db_subnet_group]
aws_rds_cluster.default: Refreshing state... [id=aurora-cluster-demo]
aws_rds_cluster_instance.cluster_instances: Refreshing state... [id=aurora-cluster-demo]

An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
  ~ update in-place

Terraform will perform the following actions:

  # aws_rds_cluster.default will be updated in-place
  ~ resource "aws_rds_cluster" "default" {
        id                                  = "aurora-cluster-demo"
      ~ port                                = 3306 -> 2000
        tags                                = {}
        # (30 unchanged attributes hidden)
    }

Plan: 0 to add, 1 to change, 0 to destroy.

Do you want to perform these actions?
  Terraform will perform the actions described above.
  Only 'yes' will be accepted to approve.

  Enter a value: yes

aws_rds_cluster.default: Modifying... [id=aurora-cluster-demo]
aws_rds_cluster.default: Still modifying... [id=aurora-cluster-demo, 10s elapsed]
aws_rds_cluster.default: Still modifying... [id=aurora-cluster-demo, 20s elapsed]
aws_rds_cluster.default: Still modifying... [id=aurora-cluster-demo, 30s elapsed]
aws_rds_cluster.default: Modifications complete after 32s [id=aurora-cluster-demo]

Apply complete! Resources: 0 added, 1 changed, 0 destroyed.
$

Note: this is my first commit to this repo, and first time understanding the aws provider internals. Extra checks on my work appreciated. 🙂

@thisdougb thisdougb requested a review from a team as a code owner March 13, 2021 12:28
@ghost ghost added size/XS Managed by automation to categorize the size of a PR. service/rds Issues and PRs that pertain to the rds service. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. labels Mar 13, 2021
@github-actions github-actions bot added the needs-triage Waiting for first response or review from a maintainer. label Mar 13, 2021
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 @thisdougb 👋

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 CONTRIBUTING 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! 😃

@thisdougb thisdougb changed the title b/resource_aws_rds_cluster: RDS cluster port config change now happens in-place b/resource_aws_rds_cluster: RDS cluster port change to happen in-place Mar 13, 2021
@darey-io
Copy link

This change is much required for flexibility on port changes on RDS

@YakDriver YakDriver self-assigned this Apr 13, 2021
@YakDriver YakDriver removed the needs-triage Waiting for first response or review from a maintainer. label Apr 13, 2021
@ghost ghost added size/S 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 Apr 13, 2021
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! 🎉

Acceptance tests on commercial (us-west-2):


--- FAIL: TestAccAWSRDSCluster_s3Restore (1556.07s)
--- PASS: TestAccAWSRDSCluster_SnapshotIdentifier_PreferredBackupWindow (409.57s)
--- PASS: TestAccAWSRDSCluster_AllowMajorVersionUpgrade (1292.89s)
--- PASS: TestAccAWSRDSCluster_AvailabilityZones (145.94s)
--- PASS: TestAccAWSRDSCluster_BacktrackWindow (169.65s)
--- PASS: TestAccAWSRDSCluster_backupsUpdate (227.64s)
--- PASS: TestAccAWSRDSCluster_basic (155.44s)
--- PASS: TestAccAWSRDSCluster_ClusterIdentifierPrefix (172.23s)
--- PASS: TestAccAWSRDSCluster_copyTagsToSnapshot (218.67s)
--- PASS: TestAccAWSRDSCluster_DbSubnetGroupName (165.69s)
--- PASS: TestAccAWSRDSCluster_DeletionProtection (176.87s)
--- PASS: TestAccAWSRDSCluster_EnabledCloudwatchLogsExports_MySQL (224.55s)
--- PASS: TestAccAWSRDSCluster_EnabledCloudwatchLogsExports_Postgresql (156.09s)
--- PASS: TestAccAWSRDSCluster_EnableHttpEndpoint (320.89s)
--- PASS: TestAccAWSRDSCluster_encrypted (156.24s)
--- PASS: TestAccAWSRDSCluster_EngineMode (472.42s)
--- PASS: TestAccAWSRDSCluster_EngineMode_Global (177.23s)
--- PASS: TestAccAWSRDSCluster_EngineMode_Multimaster (179.64s)
--- PASS: TestAccAWSRDSCluster_EngineMode_ParallelQuery (154.41s)
--- PASS: TestAccAWSRDSCluster_EngineVersion (451.42s)
--- PASS: TestAccAWSRDSCluster_EngineVersionWithPrimaryInstance (1072.19s)
--- PASS: TestAccAWSRDSCluster_generatedName (129.31s)
--- PASS: TestAccAWSRDSCluster_GlobalClusterIdentifier_EngineMode_Global (200.49s)
--- PASS: TestAccAWSRDSCluster_GlobalClusterIdentifier_EngineMode_Global_Add (193.26s)
--- PASS: TestAccAWSRDSCluster_GlobalClusterIdentifier_EngineMode_Global_Remove (190.77s)
--- PASS: TestAccAWSRDSCluster_GlobalClusterIdentifier_EngineMode_Global_Update (173.42s)
--- PASS: TestAccAWSRDSCluster_GlobalClusterIdentifier_EngineMode_Provisioned (145.43s)
--- PASS: TestAccAWSRDSCluster_GlobalClusterIdentifier_PrimarySecondaryClusters (1889.61s)
--- PASS: TestAccAWSRDSCluster_GlobalClusterIdentifier_ReplicationSourceIdentifier (1873.11s)
--- PASS: TestAccAWSRDSCluster_iamAuth (156.50s)
--- PASS: TestAccAWSRDSCluster_kmsKey (159.37s)
--- PASS: TestAccAWSRDSCluster_missingUserNameCausesError (5.45s)
--- PASS: TestAccAWSRDSCluster_PointInTimeRestore (363.01s)
--- PASS: TestAccAWSRDSCluster_PointInTimeRestore_EnabledCloudwatchLogsExports (425.71s)
--- PASS: TestAccAWSRDSCluster_Port (192.59s)
--- PASS: TestAccAWSRDSCluster_ReplicationSourceIdentifier_KmsKeyId (1637.26s)
--- PASS: TestAccAWSRDSCluster_ScalingConfiguration (316.58s)
--- PASS: TestAccAWSRDSCluster_ScalingConfiguration_DefaultMinCapacity (275.59s)
--- PASS: TestAccAWSRDSCluster_SnapshotIdentifier (451.12s)
--- PASS: TestAccAWSRDSCluster_SnapshotIdentifier_DeletionProtection (447.01s)
--- PASS: TestAccAWSRDSCluster_SnapshotIdentifier_EncryptedRestore (395.17s)
--- PASS: TestAccAWSRDSCluster_SnapshotIdentifier_EngineMode_ParallelQuery (512.02s)
--- PASS: TestAccAWSRDSCluster_SnapshotIdentifier_EngineMode_Provisioned (436.89s)
--- PASS: TestAccAWSRDSCluster_SnapshotIdentifier_EngineVersion_Different (417.48s)
--- PASS: TestAccAWSRDSCluster_SnapshotIdentifier_EngineVersion_Equal (427.16s)
--- PASS: TestAccAWSRDSCluster_SnapshotIdentifier_KmsKeyId (420.21s)
--- PASS: TestAccAWSRDSCluster_SnapshotIdentifier_MasterPassword (399.18s)
--- PASS: TestAccAWSRDSCluster_SnapshotIdentifier_MasterUsername (430.40s)
--- PASS: TestAccAWSRDSCluster_SnapshotIdentifier_PreferredMaintenanceWindow (421.70s)
--- PASS: TestAccAWSRDSCluster_SnapshotIdentifier_Tags (421.68s)
--- PASS: TestAccAWSRDSCluster_SnapshotIdentifier_VpcSecurityGroupIds (429.25s)
--- PASS: TestAccAWSRDSCluster_SnapshotIdentifier_VpcSecurityGroupIds_Tags (428.57s)
--- PASS: TestAccAWSRDSCluster_Tags (174.51s)
--- PASS: TestAccAWSRDSCluster_takeFinalSnapshot (170.97s)
--- PASS: TestAccAWSRDSCluster_updateIamRoles (161.40s)
--- SKIP: TestAccAWSRDSCluster_SnapshotIdentifier_EngineMode_Serverless (0.00s)

Acceptance tests on GovCloud:

--- FAIL: TestAccAWSRDSCluster_s3Restore (18.72s)
--- FAIL: TestAccAWSRDSCluster_updateIamRoles (206.15s)
--- PASS: TestAccAWSRDSCluster_AllowMajorVersionUpgrade (1305.98s)
--- PASS: TestAccAWSRDSCluster_AvailabilityZones (112.51s)
--- PASS: TestAccAWSRDSCluster_backupsUpdate (185.64s)
--- PASS: TestAccAWSRDSCluster_basic (157.98s)
--- PASS: TestAccAWSRDSCluster_ClusterIdentifierPrefix (121.73s)
--- PASS: TestAccAWSRDSCluster_copyTagsToSnapshot (199.70s)
--- PASS: TestAccAWSRDSCluster_DbSubnetGroupName (156.27s)
--- PASS: TestAccAWSRDSCluster_DeletionProtection (247.88s)
--- PASS: TestAccAWSRDSCluster_EnabledCloudwatchLogsExports_MySQL (240.10s)
--- PASS: TestAccAWSRDSCluster_EnabledCloudwatchLogsExports_Postgresql (158.41s)
--- PASS: TestAccAWSRDSCluster_encrypted (142.86s)
--- PASS: TestAccAWSRDSCluster_EngineVersion (438.47s)
--- PASS: TestAccAWSRDSCluster_EngineVersionWithPrimaryInstance (1158.67s)
--- PASS: TestAccAWSRDSCluster_generatedName (162.71s)
--- PASS: TestAccAWSRDSCluster_iamAuth (142.22s)
--- PASS: TestAccAWSRDSCluster_kmsKey (115.52s)
--- PASS: TestAccAWSRDSCluster_missingUserNameCausesError (5.73s)
--- PASS: TestAccAWSRDSCluster_PointInTimeRestore (363.77s)
--- PASS: TestAccAWSRDSCluster_PointInTimeRestore_EnabledCloudwatchLogsExports (373.68s)
--- PASS: TestAccAWSRDSCluster_Port (176.26s)
--- PASS: TestAccAWSRDSCluster_SnapshotIdentifier (541.86s)
--- PASS: TestAccAWSRDSCluster_SnapshotIdentifier_DeletionProtection (600.51s)
--- PASS: TestAccAWSRDSCluster_SnapshotIdentifier_EncryptedRestore (439.43s)
--- PASS: TestAccAWSRDSCluster_SnapshotIdentifier_EngineMode_Provisioned (439.34s)
--- PASS: TestAccAWSRDSCluster_SnapshotIdentifier_EngineVersion_Different (442.34s)
--- PASS: TestAccAWSRDSCluster_SnapshotIdentifier_EngineVersion_Equal (442.54s)
--- PASS: TestAccAWSRDSCluster_SnapshotIdentifier_KmsKeyId (510.69s)
--- PASS: TestAccAWSRDSCluster_SnapshotIdentifier_MasterPassword (479.56s)
--- PASS: TestAccAWSRDSCluster_SnapshotIdentifier_MasterUsername (458.81s)
--- PASS: TestAccAWSRDSCluster_SnapshotIdentifier_PreferredBackupWindow (479.52s)
--- PASS: TestAccAWSRDSCluster_SnapshotIdentifier_PreferredMaintenanceWindow (439.46s)
--- PASS: TestAccAWSRDSCluster_SnapshotIdentifier_Tags (439.32s)
--- PASS: TestAccAWSRDSCluster_SnapshotIdentifier_VpcSecurityGroupIds (414.32s)
--- PASS: TestAccAWSRDSCluster_SnapshotIdentifier_VpcSecurityGroupIds_Tags (496.54s)
--- PASS: TestAccAWSRDSCluster_Tags (242.04s)
--- PASS: TestAccAWSRDSCluster_takeFinalSnapshot (194.43s)
--- SKIP: TestAccAWSRDSCluster_BacktrackWindow (5.56s)
--- SKIP: TestAccAWSRDSCluster_EnableHttpEndpoint (11.45s)
--- SKIP: TestAccAWSRDSCluster_EngineMode (5.34s)
--- SKIP: TestAccAWSRDSCluster_EngineMode_Global (0.34s)
--- SKIP: TestAccAWSRDSCluster_EngineMode_Multimaster (16.57s)
--- SKIP: TestAccAWSRDSCluster_EngineMode_ParallelQuery (5.38s)
--- SKIP: TestAccAWSRDSCluster_GlobalClusterIdentifier_EngineMode_Global (0.32s)
--- SKIP: TestAccAWSRDSCluster_GlobalClusterIdentifier_EngineMode_Global_Add (0.33s)
--- SKIP: TestAccAWSRDSCluster_GlobalClusterIdentifier_EngineMode_Global_Remove (0.32s)
--- SKIP: TestAccAWSRDSCluster_GlobalClusterIdentifier_EngineMode_Global_Update (0.33s)
--- SKIP: TestAccAWSRDSCluster_GlobalClusterIdentifier_EngineMode_Provisioned (0.34s)
--- SKIP: TestAccAWSRDSCluster_GlobalClusterIdentifier_PrimarySecondaryClusters (0.37s)
--- SKIP: TestAccAWSRDSCluster_GlobalClusterIdentifier_ReplicationSourceIdentifier (0.36s)
--- SKIP: TestAccAWSRDSCluster_ReplicationSourceIdentifier_KmsKeyId (751.78s)
--- SKIP: TestAccAWSRDSCluster_ScalingConfiguration (5.40s)
--- SKIP: TestAccAWSRDSCluster_ScalingConfiguration_DefaultMinCapacity (10.42s)
--- SKIP: TestAccAWSRDSCluster_SnapshotIdentifier_EngineMode_ParallelQuery (11.63s)
--- SKIP: TestAccAWSRDSCluster_SnapshotIdentifier_EngineMode_Serverless (0.00s)

@YakDriver YakDriver added this to the v3.37.0 milestone Apr 13, 2021
@YakDriver YakDriver merged commit a217c31 into hashicorp:main Apr 13, 2021
@ghost
Copy link

ghost commented Apr 16, 2021

This has been released in version 3.37.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 for triage. Thanks!

@ghost
Copy link

ghost commented May 13, 2021

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!

@ghost ghost locked as resolved and limited conversation to collaborators May 13, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
service/rds Issues and PRs that pertain to the rds service. size/S 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.

AWS RDS - Port Change - Force Update
3 participants