Skip to content

Resource: awsBackupVaultNotifications

Provides an AWS Backup vault notifications 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";
const awsSnsTopicTest = new aws.snsTopic.SnsTopic(this, "test", {
  name: "backup-vault-events",
});
const dataAwsIamPolicyDocumentTest =
  new aws.dataAwsIamPolicyDocument.DataAwsIamPolicyDocument(this, "test_1", {
    policyId: "__default_policy_ID",
    statement: [
      {
        actions: ["SNS:Publish"],
        effect: "Allow",
        principals: [
          {
            identifiers: ["backup.amazonaws.com"],
            type: "Service",
          },
        ],
        resources: [awsSnsTopicTest.arn],
        sid: "__default_statement_ID",
      },
    ],
  });
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
dataAwsIamPolicyDocumentTest.overrideLogicalId("test");
const awsBackupVaultNotificationsTest =
  new aws.backupVaultNotifications.BackupVaultNotifications(this, "test_2", {
    backupVaultEvents: ["BACKUP_JOB_STARTED", "RESTORE_JOB_COMPLETED"],
    backupVaultName: "example_backup_vault",
    snsTopicArn: awsSnsTopicTest.arn,
  });
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
awsBackupVaultNotificationsTest.overrideLogicalId("test");
const awsSnsTopicPolicyTest = new aws.snsTopicPolicy.SnsTopicPolicy(
  this,
  "test_3",
  {
    arn: awsSnsTopicTest.arn,
    policy: dataAwsIamPolicyDocumentTest.json,
  }
);
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
awsSnsTopicPolicyTest.overrideLogicalId("test");

Argument Reference

The following arguments are supported:

  • backupVaultName - (Required) Name of the backup vault to add notifications for.
  • snsTopicArn - (Required) The Amazon Resource Name (ARN) that specifies the topic for a backup vault’s events
  • backupVaultEvents - (Required) An array of events that indicate the status of jobs to back up resources to the backup vault.

Attributes Reference

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

  • id - The name of the vault.
  • backupVaultArn - The ARN of the vault.

Import

Backup vault notifications can be imported using the name, e.g.,

$ terraform import aws_backup_vault_notifications.test TestVault