1. Packages
  2. AWS Classic
  3. API Docs
  4. ses
  5. IdentityPolicy

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.ses.IdentityPolicy

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

    Manages a SES Identity Policy. More information about SES Sending Authorization Policies can be found in the SES Developer Guide.

    Example Usage

    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Aws = Pulumi.Aws;
    
    return await Deployment.RunAsync(() => 
    {
        var exampleDomainIdentity = new Aws.Ses.DomainIdentity("exampleDomainIdentity", new()
        {
            Domain = "example.com",
        });
    
        var examplePolicyDocument = Aws.Iam.GetPolicyDocument.Invoke(new()
        {
            Statements = new[]
            {
                new Aws.Iam.Inputs.GetPolicyDocumentStatementInputArgs
                {
                    Actions = new[]
                    {
                        "SES:SendEmail",
                        "SES:SendRawEmail",
                    },
                    Resources = new[]
                    {
                        exampleDomainIdentity.Arn,
                    },
                    Principals = new[]
                    {
                        new Aws.Iam.Inputs.GetPolicyDocumentStatementPrincipalInputArgs
                        {
                            Identifiers = new[]
                            {
                                "*",
                            },
                            Type = "AWS",
                        },
                    },
                },
            },
        });
    
        var exampleIdentityPolicy = new Aws.Ses.IdentityPolicy("exampleIdentityPolicy", new()
        {
            Identity = exampleDomainIdentity.Arn,
            Policy = examplePolicyDocument.Apply(getPolicyDocumentResult => getPolicyDocumentResult.Json),
        });
    
    });
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/iam"
    	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ses"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		exampleDomainIdentity, err := ses.NewDomainIdentity(ctx, "exampleDomainIdentity", &ses.DomainIdentityArgs{
    			Domain: pulumi.String("example.com"),
    		})
    		if err != nil {
    			return err
    		}
    		examplePolicyDocument := iam.GetPolicyDocumentOutput(ctx, iam.GetPolicyDocumentOutputArgs{
    			Statements: iam.GetPolicyDocumentStatementArray{
    				&iam.GetPolicyDocumentStatementArgs{
    					Actions: pulumi.StringArray{
    						pulumi.String("SES:SendEmail"),
    						pulumi.String("SES:SendRawEmail"),
    					},
    					Resources: pulumi.StringArray{
    						exampleDomainIdentity.Arn,
    					},
    					Principals: iam.GetPolicyDocumentStatementPrincipalArray{
    						&iam.GetPolicyDocumentStatementPrincipalArgs{
    							Identifiers: pulumi.StringArray{
    								pulumi.String("*"),
    							},
    							Type: pulumi.String("AWS"),
    						},
    					},
    				},
    			},
    		}, nil)
    		_, err = ses.NewIdentityPolicy(ctx, "exampleIdentityPolicy", &ses.IdentityPolicyArgs{
    			Identity: exampleDomainIdentity.Arn,
    			Policy: examplePolicyDocument.ApplyT(func(examplePolicyDocument iam.GetPolicyDocumentResult) (*string, error) {
    				return &examplePolicyDocument.Json, nil
    			}).(pulumi.StringPtrOutput),
    		})
    		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.ses.DomainIdentity;
    import com.pulumi.aws.ses.DomainIdentityArgs;
    import com.pulumi.aws.iam.IamFunctions;
    import com.pulumi.aws.iam.inputs.GetPolicyDocumentArgs;
    import com.pulumi.aws.ses.IdentityPolicy;
    import com.pulumi.aws.ses.IdentityPolicyArgs;
    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 exampleDomainIdentity = new DomainIdentity("exampleDomainIdentity", DomainIdentityArgs.builder()        
                .domain("example.com")
                .build());
    
            final var examplePolicyDocument = IamFunctions.getPolicyDocument(GetPolicyDocumentArgs.builder()
                .statements(GetPolicyDocumentStatementArgs.builder()
                    .actions(                
                        "SES:SendEmail",
                        "SES:SendRawEmail")
                    .resources(exampleDomainIdentity.arn())
                    .principals(GetPolicyDocumentStatementPrincipalArgs.builder()
                        .identifiers("*")
                        .type("AWS")
                        .build())
                    .build())
                .build());
    
            var exampleIdentityPolicy = new IdentityPolicy("exampleIdentityPolicy", IdentityPolicyArgs.builder()        
                .identity(exampleDomainIdentity.arn())
                .policy(examplePolicyDocument.applyValue(getPolicyDocumentResult -> getPolicyDocumentResult).applyValue(examplePolicyDocument -> examplePolicyDocument.applyValue(getPolicyDocumentResult -> getPolicyDocumentResult.json())))
                .build());
    
        }
    }
    
    import pulumi
    import pulumi_aws as aws
    
    example_domain_identity = aws.ses.DomainIdentity("exampleDomainIdentity", domain="example.com")
    example_policy_document = aws.iam.get_policy_document_output(statements=[aws.iam.GetPolicyDocumentStatementArgs(
        actions=[
            "SES:SendEmail",
            "SES:SendRawEmail",
        ],
        resources=[example_domain_identity.arn],
        principals=[aws.iam.GetPolicyDocumentStatementPrincipalArgs(
            identifiers=["*"],
            type="AWS",
        )],
    )])
    example_identity_policy = aws.ses.IdentityPolicy("exampleIdentityPolicy",
        identity=example_domain_identity.arn,
        policy=example_policy_document.json)
    
    import * as pulumi from "@pulumi/pulumi";
    import * as aws from "@pulumi/aws";
    
    const exampleDomainIdentity = new aws.ses.DomainIdentity("exampleDomainIdentity", {domain: "example.com"});
    const examplePolicyDocument = aws.iam.getPolicyDocumentOutput({
        statements: [{
            actions: [
                "SES:SendEmail",
                "SES:SendRawEmail",
            ],
            resources: [exampleDomainIdentity.arn],
            principals: [{
                identifiers: ["*"],
                type: "AWS",
            }],
        }],
    });
    const exampleIdentityPolicy = new aws.ses.IdentityPolicy("exampleIdentityPolicy", {
        identity: exampleDomainIdentity.arn,
        policy: examplePolicyDocument.apply(examplePolicyDocument => examplePolicyDocument.json),
    });
    
    resources:
      exampleDomainIdentity:
        type: aws:ses:DomainIdentity
        properties:
          domain: example.com
      exampleIdentityPolicy:
        type: aws:ses:IdentityPolicy
        properties:
          identity: ${exampleDomainIdentity.arn}
          policy: ${examplePolicyDocument.json}
    variables:
      examplePolicyDocument:
        fn::invoke:
          Function: aws:iam:getPolicyDocument
          Arguments:
            statements:
              - actions:
                  - SES:SendEmail
                  - SES:SendRawEmail
                resources:
                  - ${exampleDomainIdentity.arn}
                principals:
                  - identifiers:
                      - '*'
                    type: AWS
    

    Create IdentityPolicy Resource

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

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

    Identity string

    Name or Amazon Resource Name (ARN) of the SES Identity.

    Policy string

    JSON string of the policy.

    Name string

    Name of the policy.

    Identity string

    Name or Amazon Resource Name (ARN) of the SES Identity.

    Policy string

    JSON string of the policy.

    Name string

    Name of the policy.

    identity String

    Name or Amazon Resource Name (ARN) of the SES Identity.

    policy String

    JSON string of the policy.

    name String

    Name of the policy.

    identity string

    Name or Amazon Resource Name (ARN) of the SES Identity.

    policy string

    JSON string of the policy.

    name string

    Name of the policy.

    identity str

    Name or Amazon Resource Name (ARN) of the SES Identity.

    policy str

    JSON string of the policy.

    name str

    Name of the policy.

    identity String

    Name or Amazon Resource Name (ARN) of the SES Identity.

    policy String

    JSON string of the policy.

    name String

    Name of the policy.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the IdentityPolicy 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 IdentityPolicy Resource

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

    Name or Amazon Resource Name (ARN) of the SES Identity.

    Name string

    Name of the policy.

    Policy string

    JSON string of the policy.

    Identity string

    Name or Amazon Resource Name (ARN) of the SES Identity.

    Name string

    Name of the policy.

    Policy string

    JSON string of the policy.

    identity String

    Name or Amazon Resource Name (ARN) of the SES Identity.

    name String

    Name of the policy.

    policy String

    JSON string of the policy.

    identity string

    Name or Amazon Resource Name (ARN) of the SES Identity.

    name string

    Name of the policy.

    policy string

    JSON string of the policy.

    identity str

    Name or Amazon Resource Name (ARN) of the SES Identity.

    name str

    Name of the policy.

    policy str

    JSON string of the policy.

    identity String

    Name or Amazon Resource Name (ARN) of the SES Identity.

    name String

    Name of the policy.

    policy String

    JSON string of the policy.

    Import

    Using pulumi import, import SES Identity Policies using the identity and policy name, separated by a pipe character (|). For example:

     $ pulumi import aws:ses/identityPolicy:IdentityPolicy example 'example.com|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