Skip to content

Resource: awsBackupPlan

Provides an AWS Backup plan resource.

Example Usage

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as aws from "./.gen/providers/aws";
new aws.backupPlan.BackupPlan(this, "example", {
  advancedBackupSetting: [
    {
      backupOptions: [
        {
          windowsVss: "enabled",
        },
      ],
      resourceType: "EC2",
    },
  ],
  name: "tf_example_backup_plan",
  rule: [
    {
      ruleName: "tf_example_backup_rule",
      schedule: "cron(0 12 * * ? *)",
      targetVaultName: "${aws_backup_vault.test.name}",
    },
  ],
});

Argument Reference

The following arguments are supported:

  • name - (Required) The display name of a backup plan.
  • rule - (Required) A rule object that specifies a scheduled task that is used to back up a selection of resources.
  • advancedBackupSetting - (Optional) An object that specifies backup options for each resource type.
  • tags - (Optional) Metadata that you can assign to help organize the plans you create. If configured with a provider defaultTags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

Rule Arguments

For rule the following attributes are supported:

  • ruleName - (Required) An display name for a backup rule.
  • targetVaultName - (Required) The name of a logical container where backups are stored.
  • schedule - (Optional) A CRON expression specifying when AWS Backup initiates a backup job.
  • enableContinuousBackup - (Optional) Enable continuous backups for supported resources.
  • startWindow - (Optional) The amount of time in minutes before beginning a backup.
  • completionWindow - (Optional) The amount of time in minutes AWS Backup attempts a backup before canceling the job and returning an error.
  • lifecycle - (Optional) The lifecycle defines when a protected resource is transitioned to cold storage and when it expires. Fields documented below.
  • recoveryPointTags - (Optional) Metadata that you can assign to help organize the resources that you create.
  • copyAction - (Optional) Configuration block(s) with copy operation settings. Detailed below.

Lifecycle Arguments

For lifecycle the following attributes are supported:

  • coldStorageAfter - (Optional) Specifies the number of days after creation that a recovery point is moved to cold storage.
  • deleteAfter - (Optional) Specifies the number of days after creation that a recovery point is deleted. Must be 90 days greater than coldStorageAfter.

Copy Action Arguments

For copy_action the following attributes are supported:

  • lifecycle - (Optional) The lifecycle defines when a protected resource is copied over to a backup vault and when it expires. Fields documented above.
  • destinationVaultArn - (Required) An Amazon Resource Name (ARN) that uniquely identifies the destination backup vault for the copied backup.

Advanced Backup Setting Arguments

For advancedBackupSetting the following attibutes are supported:

  • backupOptions - (Required) Specifies the backup option for a selected resource. This option is only available for Windows VSS backup jobs. Set to {WindowsVss = "enabled" } to enable Windows VSS backup option and create a VSS Windows backup.
  • resourceType - (Required) The type of AWS resource to be backed up. For VSS Windows backups, the only supported resource type is Amazon EC2. Valid values: ec2.

Attributes Reference

In addition to all arguments above, the following attributes are exported:

  • id - The id of the backup plan.
  • arn - The ARN of the backup plan.
  • tagsAll - A map of tags assigned to the resource, including those inherited from the provider defaultTags configuration block.
  • version - Unique, randomly generated, Unicode, UTF-8 encoded string that serves as the version ID of the backup plan.

Import

Backup Plan can be imported using the id, e.g.,

$ terraform import aws_backup_plan.test <id>