Search code examples
terraformterraform-provider-awsaws-backup

AwsBackUp supports cross region copy in terraform


Does terraform support aws backup feature for cross region copy (https://www.terraform.io/docs/providers/aws/r/backup_plan.html )?

As I read the document I can see that it does support.

But I get the following error:

Error: Unsupported argument on backup_plan.tf line 11, in resource "aws_backup_plan" "example": 11: copy_action = { An argument named "copy_action" is not expected here.

My terraform file for your reference

resource "aws_backup_plan" "example" {
    name = "example-plan"
    rule {
        rule_name = "MainRule"
        target_vault_name = "primary"
        schedule = "cron(5 8 * * ? *)"
        start_window = 480
        completion_window = 10080
        lifecycle {
            delete_after = 30
        }
        copy_action {
            destination_vault_arn = "arn:aws:backup:us-west-2:123456789:backup-vault:secondary"
        }
    }
}

But when I remove the block

copy_action {
            destination_vault_arn = "arn:aws:backup:us-west-2:123456789:backup-vault:secondary"
        }

It works just fine

Thanks


Solution

  • I assume you are running a version of the Terraform AWS Provider of 2.57.0 or older.

    Version 2.58.0 (released 3 days ago) brought support for the copy_action:

    resource/aws_backup_plan: Add rule configuration block copy_action configuration block (support cross region copy)

    You can specify in your code to require at least this version as follows:

    provider "aws" {
      version = "~> 2.58.0"
    }