1. Packages
  2. AWS Classic
  3. API Docs
  4. sesv2
  5. EmailIdentityPolicy

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

AWS Classic v6.45.0 published on Tuesday, Jul 16, 2024 by Pulumi

aws.sesv2.EmailIdentityPolicy

Explore with Pulumi AI

aws logo

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

AWS Classic v6.45.0 published on Tuesday, Jul 16, 2024 by Pulumi

    Resource for managing an AWS SESv2 (Simple Email V2) Email Identity Policy.

    Example Usage

    Basic Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as aws from "@pulumi/aws";
    
    const example = new aws.sesv2.EmailIdentity("example", {emailIdentity: "testing@example.com"});
    const exampleEmailIdentityPolicy = new aws.sesv2.EmailIdentityPolicy("example", {
        emailIdentity: example.emailIdentity,
        policyName: "example",
        policy: pulumi.interpolate`{
      "Id":"ExampleAuthorizationPolicy",
      "Version":"2012-10-17",
      "Statement":[
        {
          "Sid":"AuthorizeIAMUser",
          "Effect":"Allow",
          "Resource":"${example.arn}",
          "Principal":{
            "AWS":[
              "arn:aws:iam::123456789012:user/John",
              "arn:aws:iam::123456789012:user/Jane"
            ]
          },
          "Action":[
            "ses:DeleteEmailIdentity",
            "ses:PutEmailIdentityDkimSigningAttributes"
          ]
        }
      ]
    }
    `,
    });
    
    import pulumi
    import pulumi_aws as aws
    
    example = aws.sesv2.EmailIdentity("example", email_identity="testing@example.com")
    example_email_identity_policy = aws.sesv2.EmailIdentityPolicy("example",
        email_identity=example.email_identity,
        policy_name="example",
        policy=example.arn.apply(lambda arn: f"""{{
      "Id":"ExampleAuthorizationPolicy",
      "Version":"2012-10-17",
      "Statement":[
        {{
          "Sid":"AuthorizeIAMUser",
          "Effect":"Allow",
          "Resource":"{arn}",
          "Principal":{{
            "AWS":[
              "arn:aws:iam::123456789012:user/John",
              "arn:aws:iam::123456789012:user/Jane"
            ]
          }},
          "Action":[
            "ses:DeleteEmailIdentity",
            "ses:PutEmailIdentityDkimSigningAttributes"
          ]
        }}
      ]
    }}
    """))
    
    package main
    
    import (
    	"fmt"
    
    	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/sesv2"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		example, err := sesv2.NewEmailIdentity(ctx, "example", &sesv2.EmailIdentityArgs{
    			EmailIdentity: pulumi.String("testing@example.com"),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = sesv2.NewEmailIdentityPolicy(ctx, "example", &sesv2.EmailIdentityPolicyArgs{
    			EmailIdentity: example.EmailIdentity,
    			PolicyName:    pulumi.String("example"),
    			Policy: example.Arn.ApplyT(func(arn string) (string, error) {
    				return fmt.Sprintf(`{
      "Id":"ExampleAuthorizationPolicy",
      "Version":"2012-10-17",
      "Statement":[
        {
          "Sid":"AuthorizeIAMUser",
          "Effect":"Allow",
          "Resource":"%v",
          "Principal":{
            "AWS":[
              "arn:aws:iam::123456789012:user/John",
              "arn:aws:iam::123456789012:user/Jane"
            ]
          },
          "Action":[
            "ses:DeleteEmailIdentity",
            "ses:PutEmailIdentityDkimSigningAttributes"
          ]
        }
      ]
    }
    `, arn), nil
    			}).(pulumi.StringOutput),
    		})
    		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 example = new Aws.SesV2.EmailIdentity("example", new()
        {
            EmailIdentityDetails = "testing@example.com",
        });
    
        var exampleEmailIdentityPolicy = new Aws.SesV2.EmailIdentityPolicy("example", new()
        {
            EmailIdentity = example.EmailIdentityDetails,
            PolicyName = "example",
            Policy = example.Arn.Apply(arn => @$"{{
      ""Id"":""ExampleAuthorizationPolicy"",
      ""Version"":""2012-10-17"",
      ""Statement"":[
        {{
          ""Sid"":""AuthorizeIAMUser"",
          ""Effect"":""Allow"",
          ""Resource"":""{arn}"",
          ""Principal"":{{
            ""AWS"":[
              ""arn:aws:iam::123456789012:user/John"",
              ""arn:aws:iam::123456789012:user/Jane""
            ]
          }},
          ""Action"":[
            ""ses:DeleteEmailIdentity"",
            ""ses:PutEmailIdentityDkimSigningAttributes""
          ]
        }}
      ]
    }}
    "),
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.aws.sesv2.EmailIdentity;
    import com.pulumi.aws.sesv2.EmailIdentityArgs;
    import com.pulumi.aws.sesv2.EmailIdentityPolicy;
    import com.pulumi.aws.sesv2.EmailIdentityPolicyArgs;
    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 example = new EmailIdentity("example", EmailIdentityArgs.builder()
                .emailIdentity("testing@example.com")
                .build());
    
            var exampleEmailIdentityPolicy = new EmailIdentityPolicy("exampleEmailIdentityPolicy", EmailIdentityPolicyArgs.builder()
                .emailIdentity(example.emailIdentity())
                .policyName("example")
                .policy(example.arn().applyValue(arn -> """
    {
      "Id":"ExampleAuthorizationPolicy",
      "Version":"2012-10-17",
      "Statement":[
        {
          "Sid":"AuthorizeIAMUser",
          "Effect":"Allow",
          "Resource":"%s",
          "Principal":{
            "AWS":[
              "arn:aws:iam::123456789012:user/John",
              "arn:aws:iam::123456789012:user/Jane"
            ]
          },
          "Action":[
            "ses:DeleteEmailIdentity",
            "ses:PutEmailIdentityDkimSigningAttributes"
          ]
        }
      ]
    }
    ", arn)))
                .build());
    
        }
    }
    
    resources:
      example:
        type: aws:sesv2:EmailIdentity
        properties:
          emailIdentity: testing@example.com
      exampleEmailIdentityPolicy:
        type: aws:sesv2:EmailIdentityPolicy
        name: example
        properties:
          emailIdentity: ${example.emailIdentity}
          policyName: example
          policy: |
            {
              "Id":"ExampleAuthorizationPolicy",
              "Version":"2012-10-17",
              "Statement":[
                {
                  "Sid":"AuthorizeIAMUser",
                  "Effect":"Allow",
                  "Resource":"${example.arn}",
                  "Principal":{
                    "AWS":[
                      "arn:aws:iam::123456789012:user/John",
                      "arn:aws:iam::123456789012:user/Jane"
                    ]
                  },
                  "Action":[
                    "ses:DeleteEmailIdentity",
                    "ses:PutEmailIdentityDkimSigningAttributes"
                  ]
                }
              ]
            }        
    

    Create EmailIdentityPolicy Resource

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

    Constructor syntax

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

    Constructor example

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

    var emailIdentityPolicyResource = new Aws.SesV2.EmailIdentityPolicy("emailIdentityPolicyResource", new()
    {
        EmailIdentity = "string",
        Policy = "string",
        PolicyName = "string",
    });
    
    example, err := sesv2.NewEmailIdentityPolicy(ctx, "emailIdentityPolicyResource", &sesv2.EmailIdentityPolicyArgs{
    	EmailIdentity: pulumi.String("string"),
    	Policy:        pulumi.String("string"),
    	PolicyName:    pulumi.String("string"),
    })
    
    var emailIdentityPolicyResource = new EmailIdentityPolicy("emailIdentityPolicyResource", EmailIdentityPolicyArgs.builder()
        .emailIdentity("string")
        .policy("string")
        .policyName("string")
        .build());
    
    email_identity_policy_resource = aws.sesv2.EmailIdentityPolicy("emailIdentityPolicyResource",
        email_identity="string",
        policy="string",
        policy_name="string")
    
    const emailIdentityPolicyResource = new aws.sesv2.EmailIdentityPolicy("emailIdentityPolicyResource", {
        emailIdentity: "string",
        policy: "string",
        policyName: "string",
    });
    
    type: aws:sesv2:EmailIdentityPolicy
    properties:
        emailIdentity: string
        policy: string
        policyName: string
    

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

    EmailIdentity string
    The email identity.
    Policy string
    The text of the policy in JSON format.
    PolicyName string
    The name of the policy.
    EmailIdentity string
    The email identity.
    Policy string
    The text of the policy in JSON format.
    PolicyName string
    The name of the policy.
    emailIdentity String
    The email identity.
    policy String
    The text of the policy in JSON format.
    policyName String
    The name of the policy.
    emailIdentity string
    The email identity.
    policy string
    The text of the policy in JSON format.
    policyName string
    The name of the policy.
    email_identity str
    The email identity.
    policy str
    The text of the policy in JSON format.
    policy_name str
    The name of the policy.
    emailIdentity String
    The email identity.
    policy String
    The text of the policy in JSON format.
    policyName String
    The name of the policy.

    Outputs

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

    Get an existing EmailIdentityPolicy 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?: EmailIdentityPolicyState, opts?: CustomResourceOptions): EmailIdentityPolicy
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            email_identity: Optional[str] = None,
            policy: Optional[str] = None,
            policy_name: Optional[str] = None) -> EmailIdentityPolicy
    func GetEmailIdentityPolicy(ctx *Context, name string, id IDInput, state *EmailIdentityPolicyState, opts ...ResourceOption) (*EmailIdentityPolicy, error)
    public static EmailIdentityPolicy Get(string name, Input<string> id, EmailIdentityPolicyState? state, CustomResourceOptions? opts = null)
    public static EmailIdentityPolicy get(String name, Output<String> id, EmailIdentityPolicyState 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:
    EmailIdentity string
    The email identity.
    Policy string
    The text of the policy in JSON format.
    PolicyName string
    The name of the policy.
    EmailIdentity string
    The email identity.
    Policy string
    The text of the policy in JSON format.
    PolicyName string
    The name of the policy.
    emailIdentity String
    The email identity.
    policy String
    The text of the policy in JSON format.
    policyName String
    The name of the policy.
    emailIdentity string
    The email identity.
    policy string
    The text of the policy in JSON format.
    policyName string
    The name of the policy.
    email_identity str
    The email identity.
    policy str
    The text of the policy in JSON format.
    policy_name str
    The name of the policy.
    emailIdentity String
    The email identity.
    policy String
    The text of the policy in JSON format.
    policyName String
    The name of the policy.

    Import

    Using pulumi import, import SESv2 (Simple Email V2) Email Identity Policy using the example_id_arg. For example:

    $ pulumi import aws:sesv2/emailIdentityPolicy:EmailIdentityPolicy example example_email_identity|example_policy_name
    

    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.45.0 published on Tuesday, Jul 16, 2024 by Pulumi