1. Packages
  2. AWS Classic
  3. API Docs
  4. sns
  5. DataProtectionPolicy

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

AWS Classic v6.2.1 published on Friday, Sep 22, 2023 by Pulumi

aws.sns.DataProtectionPolicy

Explore with Pulumi AI

aws logo

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

AWS Classic v6.2.1 published on Friday, Sep 22, 2023 by Pulumi

    Provides an SNS data protection topic policy resource

    Example Usage

    using System.Collections.Generic;
    using System.Linq;
    using System.Text.Json;
    using Pulumi;
    using Aws = Pulumi.Aws;
    
    return await Deployment.RunAsync(() => 
    {
        var exampleTopic = new Aws.Sns.Topic("exampleTopic");
    
        var exampleDataProtectionPolicy = new Aws.Sns.DataProtectionPolicy("exampleDataProtectionPolicy", new()
        {
            Arn = exampleTopic.Arn,
            Policy = JsonSerializer.Serialize(new Dictionary<string, object?>
            {
                ["Description"] = "Example data protection policy",
                ["Name"] = "__example_data_protection_policy",
                ["Statement"] = new[]
                {
                    new Dictionary<string, object?>
                    {
                        ["DataDirection"] = "Inbound",
                        ["DataIdentifier"] = new[]
                        {
                            "arn:aws:dataprotection::aws:data-identifier/EmailAddress",
                        },
                        ["Operation"] = new Dictionary<string, object?>
                        {
                            ["Deny"] = new Dictionary<string, object?>
                            {
                            },
                        },
                        ["Principal"] = new[]
                        {
                            "*",
                        },
                        ["Sid"] = "__deny_statement_11ba9d96",
                    },
                },
                ["Version"] = "2021-06-01",
            }),
        });
    
    });
    
    package main
    
    import (
    	"encoding/json"
    
    	"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 {
    		exampleTopic, err := sns.NewTopic(ctx, "exampleTopic", nil)
    		if err != nil {
    			return err
    		}
    		tmpJSON0, err := json.Marshal(map[string]interface{}{
    			"Description": "Example data protection policy",
    			"Name":        "__example_data_protection_policy",
    			"Statement": []map[string]interface{}{
    				map[string]interface{}{
    					"DataDirection": "Inbound",
    					"DataIdentifier": []string{
    						"arn:aws:dataprotection::aws:data-identifier/EmailAddress",
    					},
    					"Operation": map[string]interface{}{
    						"Deny": nil,
    					},
    					"Principal": []string{
    						"*",
    					},
    					"Sid": "__deny_statement_11ba9d96",
    				},
    			},
    			"Version": "2021-06-01",
    		})
    		if err != nil {
    			return err
    		}
    		json0 := string(tmpJSON0)
    		_, err = sns.NewDataProtectionPolicy(ctx, "exampleDataProtectionPolicy", &sns.DataProtectionPolicyArgs{
    			Arn:    exampleTopic.Arn,
    			Policy: pulumi.String(json0),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    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.DataProtectionPolicy;
    import com.pulumi.aws.sns.DataProtectionPolicyArgs;
    import static com.pulumi.codegen.internal.Serialization.*;
    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 exampleTopic = new Topic("exampleTopic");
    
            var exampleDataProtectionPolicy = new DataProtectionPolicy("exampleDataProtectionPolicy", DataProtectionPolicyArgs.builder()        
                .arn(exampleTopic.arn())
                .policy(serializeJson(
                    jsonObject(
                        jsonProperty("Description", "Example data protection policy"),
                        jsonProperty("Name", "__example_data_protection_policy"),
                        jsonProperty("Statement", jsonArray(jsonObject(
                            jsonProperty("DataDirection", "Inbound"),
                            jsonProperty("DataIdentifier", jsonArray("arn:aws:dataprotection::aws:data-identifier/EmailAddress")),
                            jsonProperty("Operation", jsonObject(
                                jsonProperty("Deny", jsonObject(
    
                                ))
                            )),
                            jsonProperty("Principal", jsonArray("*")),
                            jsonProperty("Sid", "__deny_statement_11ba9d96")
                        ))),
                        jsonProperty("Version", "2021-06-01")
                    )))
                .build());
    
        }
    }
    
    import pulumi
    import json
    import pulumi_aws as aws
    
    example_topic = aws.sns.Topic("exampleTopic")
    example_data_protection_policy = aws.sns.DataProtectionPolicy("exampleDataProtectionPolicy",
        arn=example_topic.arn,
        policy=json.dumps({
            "Description": "Example data protection policy",
            "Name": "__example_data_protection_policy",
            "Statement": [{
                "DataDirection": "Inbound",
                "DataIdentifier": ["arn:aws:dataprotection::aws:data-identifier/EmailAddress"],
                "Operation": {
                    "Deny": {},
                },
                "Principal": ["*"],
                "Sid": "__deny_statement_11ba9d96",
            }],
            "Version": "2021-06-01",
        }))
    
    import * as pulumi from "@pulumi/pulumi";
    import * as aws from "@pulumi/aws";
    
    const exampleTopic = new aws.sns.Topic("exampleTopic", {});
    const exampleDataProtectionPolicy = new aws.sns.DataProtectionPolicy("exampleDataProtectionPolicy", {
        arn: exampleTopic.arn,
        policy: JSON.stringify({
            Description: "Example data protection policy",
            Name: "__example_data_protection_policy",
            Statement: [{
                DataDirection: "Inbound",
                DataIdentifier: ["arn:aws:dataprotection::aws:data-identifier/EmailAddress"],
                Operation: {
                    Deny: {},
                },
                Principal: ["*"],
                Sid: "__deny_statement_11ba9d96",
            }],
            Version: "2021-06-01",
        }),
    });
    
    resources:
      exampleTopic:
        type: aws:sns:Topic
      exampleDataProtectionPolicy:
        type: aws:sns:DataProtectionPolicy
        properties:
          arn: ${exampleTopic.arn}
          policy:
            fn::toJSON:
              Description: Example data protection policy
              Name: __example_data_protection_policy
              Statement:
                - DataDirection: Inbound
                  DataIdentifier:
                    - arn:aws:dataprotection::aws:data-identifier/EmailAddress
                  Operation:
                    Deny: {}
                  Principal:
                    - '*'
                  Sid: __deny_statement_11ba9d96
              Version: 2021-06-01
    

    Create DataProtectionPolicy Resource

    new DataProtectionPolicy(name: string, args: DataProtectionPolicyArgs, opts?: CustomResourceOptions);
    @overload
    def DataProtectionPolicy(resource_name: str,
                             opts: Optional[ResourceOptions] = None,
                             arn: Optional[str] = None,
                             policy: Optional[str] = None)
    @overload
    def DataProtectionPolicy(resource_name: str,
                             args: DataProtectionPolicyArgs,
                             opts: Optional[ResourceOptions] = None)
    func NewDataProtectionPolicy(ctx *Context, name string, args DataProtectionPolicyArgs, opts ...ResourceOption) (*DataProtectionPolicy, error)
    public DataProtectionPolicy(string name, DataProtectionPolicyArgs args, CustomResourceOptions? opts = null)
    public DataProtectionPolicy(String name, DataProtectionPolicyArgs args)
    public DataProtectionPolicy(String name, DataProtectionPolicyArgs args, CustomResourceOptions options)
    
    type: aws:sns:DataProtectionPolicy
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    
    name string
    The unique name of the resource.
    args DataProtectionPolicyArgs
    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 DataProtectionPolicyArgs
    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 DataProtectionPolicyArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args DataProtectionPolicyArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args DataProtectionPolicyArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    DataProtectionPolicy 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 DataProtectionPolicy resource accepts the following input properties:

    Arn string

    The ARN of the SNS topic

    Policy string

    The fully-formed AWS policy as JSON. For more information about building AWS IAM policy documents with this provider, see the AWS IAM Policy Document Guide.

    Arn string

    The ARN of the SNS topic

    Policy string

    The fully-formed AWS policy as JSON. For more information about building AWS IAM policy documents with this provider, see the AWS IAM Policy Document Guide.

    arn String

    The ARN of the SNS topic

    policy String

    The fully-formed AWS policy as JSON. For more information about building AWS IAM policy documents with this provider, see the AWS IAM Policy Document Guide.

    arn string

    The ARN of the SNS topic

    policy string

    The fully-formed AWS policy as JSON. For more information about building AWS IAM policy documents with this provider, see the AWS IAM Policy Document Guide.

    arn str

    The ARN of the SNS topic

    policy str

    The fully-formed AWS policy as JSON. For more information about building AWS IAM policy documents with this provider, see the AWS IAM Policy Document Guide.

    arn String

    The ARN of the SNS topic

    policy String

    The fully-formed AWS policy as JSON. For more information about building AWS IAM policy documents with this provider, see the AWS IAM Policy Document Guide.

    Outputs

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

    Id string

    The provider-assigned unique ID for this managed resource.

    Id string

    The provider-assigned unique ID for this managed resource.

    id String

    The provider-assigned unique ID for this managed resource.

    id string

    The provider-assigned unique ID for this managed resource.

    id str

    The provider-assigned unique ID for this managed resource.

    id String

    The provider-assigned unique ID for this managed resource.

    Look up Existing DataProtectionPolicy Resource

    Get an existing DataProtectionPolicy 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?: DataProtectionPolicyState, opts?: CustomResourceOptions): DataProtectionPolicy
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            arn: Optional[str] = None,
            policy: Optional[str] = None) -> DataProtectionPolicy
    func GetDataProtectionPolicy(ctx *Context, name string, id IDInput, state *DataProtectionPolicyState, opts ...ResourceOption) (*DataProtectionPolicy, error)
    public static DataProtectionPolicy Get(string name, Input<string> id, DataProtectionPolicyState? state, CustomResourceOptions? opts = null)
    public static DataProtectionPolicy get(String name, Output<String> id, DataProtectionPolicyState 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:
    Arn string

    The ARN of the SNS topic

    Policy string

    The fully-formed AWS policy as JSON. For more information about building AWS IAM policy documents with this provider, see the AWS IAM Policy Document Guide.

    Arn string

    The ARN of the SNS topic

    Policy string

    The fully-formed AWS policy as JSON. For more information about building AWS IAM policy documents with this provider, see the AWS IAM Policy Document Guide.

    arn String

    The ARN of the SNS topic

    policy String

    The fully-formed AWS policy as JSON. For more information about building AWS IAM policy documents with this provider, see the AWS IAM Policy Document Guide.

    arn string

    The ARN of the SNS topic

    policy string

    The fully-formed AWS policy as JSON. For more information about building AWS IAM policy documents with this provider, see the AWS IAM Policy Document Guide.

    arn str

    The ARN of the SNS topic

    policy str

    The fully-formed AWS policy as JSON. For more information about building AWS IAM policy documents with this provider, see the AWS IAM Policy Document Guide.

    arn String

    The ARN of the SNS topic

    policy String

    The fully-formed AWS policy as JSON. For more information about building AWS IAM policy documents with this provider, see the AWS IAM Policy Document Guide.

    Import

    Using pulumi import, import SNS Data Protection Topic Policy using the topic ARN. For example:

     $ pulumi import aws:sns/dataProtectionPolicy:DataProtectionPolicy example arn:aws:sns:us-west-2:0123456789012:example
    

    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.2.1 published on Friday, Sep 22, 2023 by Pulumi