Introduction
When using Terraform AWS provider v5.45.0 or later, the snapshot_copy block within the aws_redshift_cluster resource is no longer supported. Customers attempting to disable or manage snapshot copy through this block may encounter errors.
Problem
The snapshot_copy argument was deprecated starting with provider version v5.45.0 and completely removed from 6.x provider version.
Disabling snapshot copy by simply removing the block (which worked in v5.44.0 and earlier) does not work from v5.45.0 and later versions.
Prerequisites
Terraform AWS Provider v5.45.0+
Resource: aws_redshift_cluster
Target environment: AWS Redshift
In order to migrate from snapshot_copy block within the aws_redshift_cluster resource to aws_redshift_snapshot_copy
, we have below options.
- Disable snapshot copy from AWS redshift cluster, which should be done by removing snapshot_copy block from aws_redshift_cluster which is not working for aws provider version v5.45.0+
- Enable using
aws_redshift_snapshot_copy
Cause
For AWS Provider v5.45.0+ , removing snapshot_copy block within the aws_redshift_cluster will not disable snapshot but the apply will be successful.
If we try to add aws_redshift_snapshot_copy
after removing the snapshot_copy block, this will fail with the below error.
Error Example:
SnapshotCopyAlreadyEnabledFault: Snapshot Copy is already enabled on Cluster example-redshift
Overview of possible solutions
Solution 1: Rollback provider version
Rollback to a supported AWS provider version (≤ v5.44.0) and remove snapshot_copy from the cluster resource to disable the AWS redshift snapshot .
Upgrade the aws provider version to 5.45.0 and later.
Use the new standalone resource aws_redshift_snapshot_copy
Solution 2: Delete and re-import resource
If you are on AWS Provider v5.45.0+ and manual disable of snapshot is feasible
Manually disable the AWS Redshift cluster snapshot using AWS Console/AWS Cli
Import the snapshot using aws_redshift_snapshot_copy
Solution 3: Update the snapshot_copy as workaround.
If rollback and manual disable is not possible, please update snapshot_copy as below.
snapshot_copy {
destination_region = ""
}
Please do the terraform apply and it will fail with below error but it will disable the snapshot_copy.
UnknownSnapshotCopyRegionFault: Invalid region
Outcome
After applying the above solutions:
The cluster will either be successfully managed without snapshot_copy, or Snapshot copy will be correctly managed via the new aws_redshift_snapshot_copy resource.
Additional Information
AWS Provider Release Notes: v5.45.0
Terraform Redshift Snapshot Copy Resource: Documentation