Provides an AWS Backup vault notifications resource.
resource "aws_sns_topic" "test" {
name = "backup-vault-events"
}
data "aws_iam_policy_document" "test" {
policy_id = "__default_policy_ID"
statement {
actions = [
"SNS:Publish",
]
effect = "Allow"
principals {
type = "Service"
identifiers = ["backup.amazonaws.com"]
}
resources = [
aws_sns_topic.test.arn,
]
sid = "__default_statement_ID"
}
}
resource "aws_sns_topic_policy" "test" {
arn = aws_sns_topic.test.arn
policy = data.aws_iam_policy_document.test.json
}
resource "aws_backup_vault_notifications" "test" {
backup_vault_name = "example_backup_vault"
sns_topic_arn = aws_sns_topic.test.arn
backup_vault_events = ["BACKUP_JOB_STARTED", "RESTORE_JOB_COMPLETED"]
}
This resource supports the following arguments:
backup_vault_name
- (Required) Name of the backup vault to add notifications for.sns_topic_arn
- (Required) The Amazon Resource Name (ARN) that specifies the topic for a backup vault’s eventsbackup_vault_events
- (Required) An array of events that indicate the status of jobs to back up resources to the backup vault.This resource exports the following attributes in addition to the arguments above:
id
- The name of the vault.backup_vault_arn
- The ARN of the vault.In Terraform v1.5.0 and later, use an import
block to import Backup vault notifications using the name
. For example:
import {
to = aws_backup_vault_notifications.test
id = "TestVault"
}
Using terraform import
, import Backup vault notifications using the name
. For example:
% terraform import aws_backup_vault_notifications.test TestVault