Skip to content

Commit

Permalink
r/aws_redshift_cluster: skip_final_snapshot updates state only (#36635)
Browse files Browse the repository at this point in the history
Previously an update to `skip_final_snapshot` would trigger a call to the ModifyCluster API, which fails if no other arguments are modified.

Before:

  ```
  Terraform will perform the following actions:

  # aws_redshift_cluster.example will be updated in-place
  ~ resource "aws_redshift_cluster" "example" {
        id                                   = "tf-redshift-cluster"
      ~ skip_final_snapshot                  = false -> true
        tags                                 = {}
        # (38 unchanged attributes hidden)

        # (1 unchanged block hidden)
    }

Plan: 0 to add, 1 to change, 0 to destroy.
aws_redshift_cluster.example: Modifying... [id=tf-redshift-cluster]
╷
│ Error: modifying Redshift Cluster (tf-redshift-cluster): InvalidParameterCombination: No modifications were requested
│       status code: 400, request id: 0b087c95-ac6b-4ad6-8eed-ded497fb4a2e
│
│   with aws_redshift_cluster.example,
│   on main.tf line 13, in resource "aws_redshift_cluster" "example":
│   13: resource "aws_redshift_cluster" "example" {
│
╵
```

After:

```
Terraform will perform the following actions:

  # aws_redshift_cluster.example will be updated in-place
  ~ resource "aws_redshift_cluster" "example" {
        id                                   = "tf-redshift-cluster"
      ~ skip_final_snapshot                  = false -> true
        tags                                 = {}
        # (38 unchanged attributes hidden)

        # (1 unchanged block hidden)
    }

Plan: 0 to add, 1 to change, 0 to destroy.
aws_redshift_cluster.example: Modifying... [id=tf-redshift-cluster]
aws_redshift_cluster.example: Modifications complete after 1s [id=tf-redshift-cluster]

Apply complete! Resources: 0 added, 1 changed, 0 destroyed.
```
  • Loading branch information
jar-b committed Mar 28, 2024
1 parent 8354648 commit aa89753
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .changelog/36635.txt
@@ -0,0 +1,3 @@
```release-note:bug
resource/aws_redshift_cluster: Fix `InvalidParameterCombination` errors when updating only `skip_final_snapshot`
```
2 changes: 1 addition & 1 deletion internal/service/redshift/cluster.go
Expand Up @@ -738,7 +738,7 @@ func resourceClusterUpdate(ctx context.Context, d *schema.ResourceData, meta int
var diags diag.Diagnostics
conn := meta.(*conns.AWSClient).RedshiftConn(ctx)

if d.HasChangesExcept("aqua_configuration_status", "availability_zone", "iam_roles", "logging", "multi_az", "snapshot_copy", "tags", "tags_all") {
if d.HasChangesExcept("aqua_configuration_status", "availability_zone", "iam_roles", "logging", "multi_az", "snapshot_copy", "tags", "tags_all", "skip_final_snapshot") {
input := &redshift.ModifyClusterInput{
ClusterIdentifier: aws.String(d.Id()),
}
Expand Down

0 comments on commit aa89753

Please sign in to comment.