1. Packages
  2. AWS Classic
  3. API Docs
  4. backup
  5. VaultNotifications

Try AWS Native preview for resources not in the classic version.

AWS Classic v6.32.0 published on Friday, Apr 19, 2024 by Pulumi

aws.backup.VaultNotifications

Explore with Pulumi AI

aws logo

Try AWS Native preview for resources not in the classic version.

AWS Classic v6.32.0 published on Friday, Apr 19, 2024 by Pulumi

    Provides an AWS Backup vault notifications resource.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as aws from "@pulumi/aws";
    
    const testTopic = new aws.sns.Topic("test", {name: "backup-vault-events"});
    const test = testTopic.arn.apply(arn => aws.iam.getPolicyDocumentOutput({
        policyId: "__default_policy_ID",
        statements: [{
            actions: ["SNS:Publish"],
            effect: "Allow",
            principals: [{
                type: "Service",
                identifiers: ["backup.amazonaws.com"],
            }],
            resources: [arn],
            sid: "__default_statement_ID",
        }],
    }));
    const testTopicPolicy = new aws.sns.TopicPolicy("test", {
        arn: testTopic.arn,
        policy: test.apply(test => test.json),
    });
    const testVaultNotifications = new aws.backup.VaultNotifications("test", {
        backupVaultName: "example_backup_vault",
        snsTopicArn: testTopic.arn,
        backupVaultEvents: [
            "BACKUP_JOB_STARTED",
            "RESTORE_JOB_COMPLETED",
        ],
    });
    
    import pulumi
    import pulumi_aws as aws
    
    test_topic = aws.sns.Topic("test", name="backup-vault-events")
    test = test_topic.arn.apply(lambda arn: aws.iam.get_policy_document_output(policy_id="__default_policy_ID",
        statements=[aws.iam.GetPolicyDocumentStatementArgs(
            actions=["SNS:Publish"],
            effect="Allow",
            principals=[aws.iam.GetPolicyDocumentStatementPrincipalArgs(
                type="Service",
                identifiers=["backup.amazonaws.com"],
            )],
            resources=[arn],
            sid="__default_statement_ID",
        )]))
    test_topic_policy = aws.sns.TopicPolicy("test",
        arn=test_topic.arn,
        policy=test.json)
    test_vault_notifications = aws.backup.VaultNotifications("test",
        backup_vault_name="example_backup_vault",
        sns_topic_arn=test_topic.arn,
        backup_vault_events=[
            "BACKUP_JOB_STARTED",
            "RESTORE_JOB_COMPLETED",
        ])
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/backup"
    	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/iam"
    	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/sns"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    func main() {
    pulumi.Run(func(ctx *pulumi.Context) error {
    testTopic, err := sns.NewTopic(ctx, "test", &sns.TopicArgs{
    Name: pulumi.String("backup-vault-events"),
    })
    if err != nil {
    return err
    }
    test := testTopic.Arn.ApplyT(func(arn string) (iam.GetPolicyDocumentResult, error) {
    return iam.GetPolicyDocumentOutput(ctx, iam.GetPolicyDocumentOutputArgs{
    PolicyId: "__default_policy_ID",
    Statements: []iam.GetPolicyDocumentStatement{
    {
    Actions: []string{
    "SNS:Publish",
    },
    Effect: "Allow",
    Principals: []iam.GetPolicyDocumentStatementPrincipal{
    {
    Type: "Service",
    Identifiers: []string{
    "backup.amazonaws.com",
    },
    },
    },
    Resources: interface{}{
    arn,
    },
    Sid: "__default_statement_ID",
    },
    },
    }, nil), nil
    }).(iam.GetPolicyDocumentResultOutput)
    _, err = sns.NewTopicPolicy(ctx, "test", &sns.TopicPolicyArgs{
    Arn: testTopic.Arn,
    Policy: test.ApplyT(func(test iam.GetPolicyDocumentResult) (*string, error) {
    return &test.Json, nil
    }).(pulumi.StringPtrOutput),
    })
    if err != nil {
    return err
    }
    _, err = backup.NewVaultNotifications(ctx, "test", &backup.VaultNotificationsArgs{
    BackupVaultName: pulumi.String("example_backup_vault"),
    SnsTopicArn: testTopic.Arn,
    BackupVaultEvents: pulumi.StringArray{
    pulumi.String("BACKUP_JOB_STARTED"),
    pulumi.String("RESTORE_JOB_COMPLETED"),
    },
    })
    if err != nil {
    return err
    }
    return nil
    })
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Aws = Pulumi.Aws;
    
    return await Deployment.RunAsync(() => 
    {
        var testTopic = new Aws.Sns.Topic("test", new()
        {
            Name = "backup-vault-events",
        });
    
        var test = Aws.Iam.GetPolicyDocument.Invoke(new()
        {
            PolicyId = "__default_policy_ID",
            Statements = new[]
            {
                new Aws.Iam.Inputs.GetPolicyDocumentStatementInputArgs
                {
                    Actions = new[]
                    {
                        "SNS:Publish",
                    },
                    Effect = "Allow",
                    Principals = new[]
                    {
                        new Aws.Iam.Inputs.GetPolicyDocumentStatementPrincipalInputArgs
                        {
                            Type = "Service",
                            Identifiers = new[]
                            {
                                "backup.amazonaws.com",
                            },
                        },
                    },
                    Resources = new[]
                    {
                        testTopic.Arn,
                    },
                    Sid = "__default_statement_ID",
                },
            },
        });
    
        var testTopicPolicy = new Aws.Sns.TopicPolicy("test", new()
        {
            Arn = testTopic.Arn,
            Policy = test.Apply(getPolicyDocumentResult => getPolicyDocumentResult.Json),
        });
    
        var testVaultNotifications = new Aws.Backup.VaultNotifications("test", new()
        {
            BackupVaultName = "example_backup_vault",
            SnsTopicArn = testTopic.Arn,
            BackupVaultEvents = new[]
            {
                "BACKUP_JOB_STARTED",
                "RESTORE_JOB_COMPLETED",
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.aws.sns.Topic;
    import com.pulumi.aws.sns.TopicArgs;
    import com.pulumi.aws.iam.IamFunctions;
    import com.pulumi.aws.iam.inputs.GetPolicyDocumentArgs;
    import com.pulumi.aws.sns.TopicPolicy;
    import com.pulumi.aws.sns.TopicPolicyArgs;
    import com.pulumi.aws.backup.VaultNotifications;
    import com.pulumi.aws.backup.VaultNotificationsArgs;
    import java.util.List;
    import java.util.ArrayList;
    import java.util.Map;
    import java.io.File;
    import java.nio.file.Files;
    import java.nio.file.Paths;
    
    public class App {
        public static void main(String[] args) {
            Pulumi.run(App::stack);
        }
    
        public static void stack(Context ctx) {
            var testTopic = new Topic("testTopic", TopicArgs.builder()        
                .name("backup-vault-events")
                .build());
    
            final var test = IamFunctions.getPolicyDocument(GetPolicyDocumentArgs.builder()
                .policyId("__default_policy_ID")
                .statements(GetPolicyDocumentStatementArgs.builder()
                    .actions("SNS:Publish")
                    .effect("Allow")
                    .principals(GetPolicyDocumentStatementPrincipalArgs.builder()
                        .type("Service")
                        .identifiers("backup.amazonaws.com")
                        .build())
                    .resources(testTopic.arn())
                    .sid("__default_statement_ID")
                    .build())
                .build());
    
            var testTopicPolicy = new TopicPolicy("testTopicPolicy", TopicPolicyArgs.builder()        
                .arn(testTopic.arn())
                .policy(test.applyValue(getPolicyDocumentResult -> getPolicyDocumentResult).applyValue(test -> test.applyValue(getPolicyDocumentResult -> getPolicyDocumentResult.json())))
                .build());
    
            var testVaultNotifications = new VaultNotifications("testVaultNotifications", VaultNotificationsArgs.builder()        
                .backupVaultName("example_backup_vault")
                .snsTopicArn(testTopic.arn())
                .backupVaultEvents(            
                    "BACKUP_JOB_STARTED",
                    "RESTORE_JOB_COMPLETED")
                .build());
    
        }
    }
    
    resources:
      testTopic:
        type: aws:sns:Topic
        name: test
        properties:
          name: backup-vault-events
      testTopicPolicy:
        type: aws:sns:TopicPolicy
        name: test
        properties:
          arn: ${testTopic.arn}
          policy: ${test.json}
      testVaultNotifications:
        type: aws:backup:VaultNotifications
        name: test
        properties:
          backupVaultName: example_backup_vault
          snsTopicArn: ${testTopic.arn}
          backupVaultEvents:
            - BACKUP_JOB_STARTED
            - RESTORE_JOB_COMPLETED
    variables:
      test:
        fn::invoke:
          Function: aws:iam:getPolicyDocument
          Arguments:
            policyId: __default_policy_ID
            statements:
              - actions:
                  - SNS:Publish
                effect: Allow
                principals:
                  - type: Service
                    identifiers:
                      - backup.amazonaws.com
                resources:
                  - ${testTopic.arn}
                sid: __default_statement_ID
    

    Create VaultNotifications Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new VaultNotifications(name: string, args: VaultNotificationsArgs, opts?: CustomResourceOptions);
    @overload
    def VaultNotifications(resource_name: str,
                           args: VaultNotificationsArgs,
                           opts: Optional[ResourceOptions] = None)
    
    @overload
    def VaultNotifications(resource_name: str,
                           opts: Optional[ResourceOptions] = None,
                           backup_vault_events: Optional[Sequence[str]] = None,
                           backup_vault_name: Optional[str] = None,
                           sns_topic_arn: Optional[str] = None)
    func NewVaultNotifications(ctx *Context, name string, args VaultNotificationsArgs, opts ...ResourceOption) (*VaultNotifications, error)
    public VaultNotifications(string name, VaultNotificationsArgs args, CustomResourceOptions? opts = null)
    public VaultNotifications(String name, VaultNotificationsArgs args)
    public VaultNotifications(String name, VaultNotificationsArgs args, CustomResourceOptions options)
    
    type: aws:backup:VaultNotifications
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    

    Parameters

    name string
    The unique name of the resource.
    args VaultNotificationsArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resource.
    args VaultNotificationsArgs
    The arguments to resource properties.
    opts ResourceOptions
    Bag of options to control resource's behavior.
    ctx Context
    Context object for the current deployment.
    name string
    The unique name of the resource.
    args VaultNotificationsArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args VaultNotificationsArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args VaultNotificationsArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Example

    The following reference example uses placeholder values for all input properties.

    var vaultNotificationsResource = new Aws.Backup.VaultNotifications("vaultNotificationsResource", new()
    {
        BackupVaultEvents = new[]
        {
            "string",
        },
        BackupVaultName = "string",
        SnsTopicArn = "string",
    });
    
    example, err := backup.NewVaultNotifications(ctx, "vaultNotificationsResource", &backup.VaultNotificationsArgs{
    	BackupVaultEvents: pulumi.StringArray{
    		pulumi.String("string"),
    	},
    	BackupVaultName: pulumi.String("string"),
    	SnsTopicArn:     pulumi.String("string"),
    })
    
    var vaultNotificationsResource = new VaultNotifications("vaultNotificationsResource", VaultNotificationsArgs.builder()        
        .backupVaultEvents("string")
        .backupVaultName("string")
        .snsTopicArn("string")
        .build());
    
    vault_notifications_resource = aws.backup.VaultNotifications("vaultNotificationsResource",
        backup_vault_events=["string"],
        backup_vault_name="string",
        sns_topic_arn="string")
    
    const vaultNotificationsResource = new aws.backup.VaultNotifications("vaultNotificationsResource", {
        backupVaultEvents: ["string"],
        backupVaultName: "string",
        snsTopicArn: "string",
    });
    
    type: aws:backup:VaultNotifications
    properties:
        backupVaultEvents:
            - string
        backupVaultName: string
        snsTopicArn: string
    

    VaultNotifications Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    The VaultNotifications resource accepts the following input properties:

    BackupVaultEvents List<string>
    An array of events that indicate the status of jobs to back up resources to the backup vault.
    BackupVaultName string
    Name of the backup vault to add notifications for.
    SnsTopicArn string
    The Amazon Resource Name (ARN) that specifies the topic for a backup vault’s events
    BackupVaultEvents []string
    An array of events that indicate the status of jobs to back up resources to the backup vault.
    BackupVaultName string
    Name of the backup vault to add notifications for.
    SnsTopicArn string
    The Amazon Resource Name (ARN) that specifies the topic for a backup vault’s events
    backupVaultEvents List<String>
    An array of events that indicate the status of jobs to back up resources to the backup vault.
    backupVaultName String
    Name of the backup vault to add notifications for.
    snsTopicArn String
    The Amazon Resource Name (ARN) that specifies the topic for a backup vault’s events
    backupVaultEvents string[]
    An array of events that indicate the status of jobs to back up resources to the backup vault.
    backupVaultName string
    Name of the backup vault to add notifications for.
    snsTopicArn string
    The Amazon Resource Name (ARN) that specifies the topic for a backup vault’s events
    backup_vault_events Sequence[str]
    An array of events that indicate the status of jobs to back up resources to the backup vault.
    backup_vault_name str
    Name of the backup vault to add notifications for.
    sns_topic_arn str
    The Amazon Resource Name (ARN) that specifies the topic for a backup vault’s events
    backupVaultEvents List<String>
    An array of events that indicate the status of jobs to back up resources to the backup vault.
    backupVaultName String
    Name of the backup vault to add notifications for.
    snsTopicArn String
    The Amazon Resource Name (ARN) that specifies the topic for a backup vault’s events

    Outputs

    All input properties are implicitly available as output properties. Additionally, the VaultNotifications resource produces the following output properties:

    BackupVaultArn string
    The ARN of the vault.
    Id string
    The provider-assigned unique ID for this managed resource.
    BackupVaultArn string
    The ARN of the vault.
    Id string
    The provider-assigned unique ID for this managed resource.
    backupVaultArn String
    The ARN of the vault.
    id String
    The provider-assigned unique ID for this managed resource.
    backupVaultArn string
    The ARN of the vault.
    id string
    The provider-assigned unique ID for this managed resource.
    backup_vault_arn str
    The ARN of the vault.
    id str
    The provider-assigned unique ID for this managed resource.
    backupVaultArn String
    The ARN of the vault.
    id String
    The provider-assigned unique ID for this managed resource.

    Look up Existing VaultNotifications Resource

    Get an existing VaultNotifications resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

    public static get(name: string, id: Input<ID>, state?: VaultNotificationsState, opts?: CustomResourceOptions): VaultNotifications
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            backup_vault_arn: Optional[str] = None,
            backup_vault_events: Optional[Sequence[str]] = None,
            backup_vault_name: Optional[str] = None,
            sns_topic_arn: Optional[str] = None) -> VaultNotifications
    func GetVaultNotifications(ctx *Context, name string, id IDInput, state *VaultNotificationsState, opts ...ResourceOption) (*VaultNotifications, error)
    public static VaultNotifications Get(string name, Input<string> id, VaultNotificationsState? state, CustomResourceOptions? opts = null)
    public static VaultNotifications get(String name, Output<String> id, VaultNotificationsState state, CustomResourceOptions options)
    Resource lookup is not supported in YAML
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    resource_name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    The following state arguments are supported:
    BackupVaultArn string
    The ARN of the vault.
    BackupVaultEvents List<string>
    An array of events that indicate the status of jobs to back up resources to the backup vault.
    BackupVaultName string
    Name of the backup vault to add notifications for.
    SnsTopicArn string
    The Amazon Resource Name (ARN) that specifies the topic for a backup vault’s events
    BackupVaultArn string
    The ARN of the vault.
    BackupVaultEvents []string
    An array of events that indicate the status of jobs to back up resources to the backup vault.
    BackupVaultName string
    Name of the backup vault to add notifications for.
    SnsTopicArn string
    The Amazon Resource Name (ARN) that specifies the topic for a backup vault’s events
    backupVaultArn String
    The ARN of the vault.
    backupVaultEvents List<String>
    An array of events that indicate the status of jobs to back up resources to the backup vault.
    backupVaultName String
    Name of the backup vault to add notifications for.
    snsTopicArn String
    The Amazon Resource Name (ARN) that specifies the topic for a backup vault’s events
    backupVaultArn string
    The ARN of the vault.
    backupVaultEvents string[]
    An array of events that indicate the status of jobs to back up resources to the backup vault.
    backupVaultName string
    Name of the backup vault to add notifications for.
    snsTopicArn string
    The Amazon Resource Name (ARN) that specifies the topic for a backup vault’s events
    backup_vault_arn str
    The ARN of the vault.
    backup_vault_events Sequence[str]
    An array of events that indicate the status of jobs to back up resources to the backup vault.
    backup_vault_name str
    Name of the backup vault to add notifications for.
    sns_topic_arn str
    The Amazon Resource Name (ARN) that specifies the topic for a backup vault’s events
    backupVaultArn String
    The ARN of the vault.
    backupVaultEvents List<String>
    An array of events that indicate the status of jobs to back up resources to the backup vault.
    backupVaultName String
    Name of the backup vault to add notifications for.
    snsTopicArn String
    The Amazon Resource Name (ARN) that specifies the topic for a backup vault’s events

    Import

    Using pulumi import, import Backup vault notifications using the name. For example:

    $ pulumi import aws:backup/vaultNotifications:VaultNotifications test TestVault
    

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    AWS Classic pulumi/pulumi-aws
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the aws Terraform Provider.
    aws logo

    Try AWS Native preview for resources not in the classic version.

    AWS Classic v6.32.0 published on Friday, Apr 19, 2024 by Pulumi