1. Registry
  2. Packages
  3. AWS
  4. API Docs
  5. pinpoint
  6. Smsvoicev2ResourcePolicy
Viewing docs for AWS v7.46.0
published on Thursday, Sep 10, 2026 by Pulumi
aws logo aws logo
Viewing docs for AWS v7.46.0
published on Thursday, Sep 10, 2026 by Pulumi

    Manages an AWS End User Messaging SMS Resource Policy.

    Example Usage

    Basic Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as aws from "@pulumi/aws";
    
    const exampleSmsvoicev2PhoneNumber = new aws.pinpoint.Smsvoicev2PhoneNumber("example", {
        isoCountryCode: "US",
        messageType: "TRANSACTIONAL",
        numberType: "SIMULATOR",
        numberCapabilities: ["SMS"],
    });
    const example = aws.iam.getPolicyDocumentOutput({
        statements: [{
            principals: [{
                type: "AWS",
                identifiers: ["123456789012"],
            }],
            effect: "Allow",
            actions: ["sms-voice:SendTextMessage"],
            resources: [exampleSmsvoicev2PhoneNumber.arn],
        }],
    });
    const exampleSmsvoicev2ResourcePolicy = new aws.pinpoint.Smsvoicev2ResourcePolicy("example", {
        resourceArn: exampleSmsvoicev2PhoneNumber.arn,
        policy: example.json,
    });
    
    import pulumi
    import pulumi_aws as aws
    
    example_smsvoicev2_phone_number = aws.pinpoint.Smsvoicev2PhoneNumber("example",
        iso_country_code="US",
        message_type="TRANSACTIONAL",
        number_type="SIMULATOR",
        number_capabilities=["SMS"])
    example = aws.iam.get_policy_document_output(statements=[{
        "principals": [{
            "type": "AWS",
            "identifiers": ["123456789012"],
        }],
        "effect": "Allow",
        "actions": ["sms-voice:SendTextMessage"],
        "resources": [example_smsvoicev2_phone_number.arn],
    }])
    example_smsvoicev2_resource_policy = aws.pinpoint.Smsvoicev2ResourcePolicy("example",
        resource_arn=example_smsvoicev2_phone_number.arn,
        policy=example.json)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/iam"
    	"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/pinpoint"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		exampleSmsvoicev2PhoneNumber, err := pinpoint.NewSmsvoicev2PhoneNumber(ctx, "example", &pinpoint.Smsvoicev2PhoneNumberArgs{
    			IsoCountryCode: pulumi.String("US"),
    			MessageType:    pulumi.String("TRANSACTIONAL"),
    			NumberType:     pulumi.String("SIMULATOR"),
    			NumberCapabilities: pulumi.StringArray{
    				pulumi.String("SMS"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		example := iam.GetPolicyDocumentOutput(ctx, iam.GetPolicyDocumentOutputArgs{
    			Statements: iam.GetPolicyDocumentStatementArray{
    				&iam.GetPolicyDocumentStatementArgs{
    					Principals: iam.GetPolicyDocumentStatementPrincipalArray{
    						&iam.GetPolicyDocumentStatementPrincipalArgs{
    							Type: pulumi.String("AWS"),
    							Identifiers: pulumi.StringArray{
    								pulumi.String("123456789012"),
    							},
    						},
    					},
    					Effect: pulumi.String("Allow"),
    					Actions: pulumi.StringArray{
    						pulumi.String("sms-voice:SendTextMessage"),
    					},
    					Resources: pulumi.StringArray{
    						exampleSmsvoicev2PhoneNumber.Arn,
    					},
    				},
    			},
    		}, nil)
    		_, err = pinpoint.NewSmsvoicev2ResourcePolicy(ctx, "example", &pinpoint.Smsvoicev2ResourcePolicyArgs{
    			ResourceArn: exampleSmsvoicev2PhoneNumber.Arn,
    			Policy:      example.Json(),
    		})
    		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 exampleSmsvoicev2PhoneNumber = new Aws.Pinpoint.Smsvoicev2PhoneNumber("example", new()
        {
            IsoCountryCode = "US",
            MessageType = "TRANSACTIONAL",
            NumberType = "SIMULATOR",
            NumberCapabilities = new[]
            {
                "SMS",
            },
        });
    
        var example = Aws.Iam.GetPolicyDocument.Invoke(new()
        {
            Statements = new[]
            {
                new Aws.Iam.Inputs.GetPolicyDocumentStatementInputArgs
                {
                    Principals = new[]
                    {
                        new Aws.Iam.Inputs.GetPolicyDocumentStatementPrincipalInputArgs
                        {
                            Type = "AWS",
                            Identifiers = new[]
                            {
                                "123456789012",
                            },
                        },
                    },
                    Effect = "Allow",
                    Actions = new[]
                    {
                        "sms-voice:SendTextMessage",
                    },
                    Resources = new[]
                    {
                        exampleSmsvoicev2PhoneNumber.Arn,
                    },
                },
            },
        });
    
        var exampleSmsvoicev2ResourcePolicy = new Aws.Pinpoint.Smsvoicev2ResourcePolicy("example", new()
        {
            ResourceArn = exampleSmsvoicev2PhoneNumber.Arn,
            Policy = example.Apply(getPolicyDocumentResult => getPolicyDocumentResult.Json),
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.aws.pinpoint.Smsvoicev2PhoneNumber;
    import com.pulumi.aws.pinpoint.Smsvoicev2PhoneNumberArgs;
    import com.pulumi.aws.iam.IamFunctions;
    import com.pulumi.aws.iam.inputs.GetPolicyDocumentArgs;
    import com.pulumi.aws.iam.inputs.GetPolicyDocumentStatementArgs;
    import com.pulumi.aws.iam.inputs.GetPolicyDocumentStatementPrincipalArgs;
    import com.pulumi.aws.pinpoint.Smsvoicev2ResourcePolicy;
    import com.pulumi.aws.pinpoint.Smsvoicev2ResourcePolicyArgs;
    import java.util.ArrayList;
    import java.util.Arrays;
    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 exampleSmsvoicev2PhoneNumber = new Smsvoicev2PhoneNumber("exampleSmsvoicev2PhoneNumber", Smsvoicev2PhoneNumberArgs.builder()
                .isoCountryCode("US")
                .messageType("TRANSACTIONAL")
                .numberType("SIMULATOR")
                .numberCapabilities("SMS")
                .build());
    
            final var example = IamFunctions.getPolicyDocument(GetPolicyDocumentArgs.builder()
                .statements(GetPolicyDocumentStatementArgs.builder()
                    .principals(GetPolicyDocumentStatementPrincipalArgs.builder()
                        .type("AWS")
                        .identifiers("123456789012")
                        .build())
                    .effect("Allow")
                    .actions("sms-voice:SendTextMessage")
                    .resources(exampleSmsvoicev2PhoneNumber.arn())
                    .build())
                .build());
    
            var exampleSmsvoicev2ResourcePolicy = new Smsvoicev2ResourcePolicy("exampleSmsvoicev2ResourcePolicy", Smsvoicev2ResourcePolicyArgs.builder()
                .resourceArn(exampleSmsvoicev2PhoneNumber.arn())
                .policy(example.applyValue(_example -> _example.json()))
                .build());
    
        }
    }
    
    resources:
      exampleSmsvoicev2PhoneNumber:
        type: aws:pinpoint:Smsvoicev2PhoneNumber
        name: example
        properties:
          isoCountryCode: US
          messageType: TRANSACTIONAL
          numberType: SIMULATOR
          numberCapabilities:
            - SMS
      exampleSmsvoicev2ResourcePolicy:
        type: aws:pinpoint:Smsvoicev2ResourcePolicy
        name: example
        properties:
          resourceArn: ${exampleSmsvoicev2PhoneNumber.arn}
          policy: ${example.json}
    variables:
      example:
        fn::invoke:
          function: aws:iam:getPolicyDocument
          arguments:
            statements:
              - principals:
                  - type: AWS
                    identifiers:
                      - '123456789012'
                effect: Allow
                actions:
                  - sms-voice:SendTextMessage
                resources:
                  - ${exampleSmsvoicev2PhoneNumber.arn}
    
    pulumi {
      required_providers {
        aws = {
          source = "pulumi/aws"
        }
      }
    }
    
    data "aws_iam_getpolicydocument" "example" {
      statements {
        principals {
          type        = "AWS"
          identifiers = ["123456789012"]
        }
        effect    = "Allow"
        actions   = ["sms-voice:SendTextMessage"]
        resources = [aws_pinpoint_smsvoicev2phonenumber.example.arn]
      }
    }
    
    resource "aws_pinpoint_smsvoicev2phonenumber" "example" {
      iso_country_code    = "US"
      message_type        = "TRANSACTIONAL"
      number_type         = "SIMULATOR"
      number_capabilities = ["SMS"]
    }
    resource "aws_pinpoint_smsvoicev2resourcepolicy" "example" {
      resource_arn = aws_pinpoint_smsvoicev2phonenumber.example.arn
      policy       = data.aws_iam_getpolicydocument.example.json
    }
    

    Create Smsvoicev2ResourcePolicy Resource

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

    Constructor syntax

    new Smsvoicev2ResourcePolicy(name: string, args: Smsvoicev2ResourcePolicyArgs, opts?: CustomResourceOptions);
    @overload
    def Smsvoicev2ResourcePolicy(resource_name: str,
                                 args: Smsvoicev2ResourcePolicyArgs,
                                 opts: Optional[ResourceOptions] = None)
    
    @overload
    def Smsvoicev2ResourcePolicy(resource_name: str,
                                 opts: Optional[ResourceOptions] = None,
                                 policy: Optional[str] = None,
                                 resource_arn: Optional[str] = None,
                                 region: Optional[str] = None)
    func NewSmsvoicev2ResourcePolicy(ctx *Context, name string, args Smsvoicev2ResourcePolicyArgs, opts ...ResourceOption) (*Smsvoicev2ResourcePolicy, error)
    public Smsvoicev2ResourcePolicy(string name, Smsvoicev2ResourcePolicyArgs args, CustomResourceOptions? opts = null)
    public Smsvoicev2ResourcePolicy(String name, Smsvoicev2ResourcePolicyArgs args)
    public Smsvoicev2ResourcePolicy(String name, Smsvoicev2ResourcePolicyArgs args, CustomResourceOptions options)
    
    type: aws:pinpoint:Smsvoicev2ResourcePolicy
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    
    resource "aws_pinpoint_smsvoicev2_resource_policy" "name" {
        # resource properties
    }

    Parameters

    name string
    The unique name of the resource.
    args Smsvoicev2ResourcePolicyArgs
    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 Smsvoicev2ResourcePolicyArgs
    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 Smsvoicev2ResourcePolicyArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args Smsvoicev2ResourcePolicyArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args Smsvoicev2ResourcePolicyArgs
    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 smsvoicev2ResourcePolicyResource = new Aws.Pinpoint.Smsvoicev2ResourcePolicy("smsvoicev2ResourcePolicyResource", new()
    {
        Policy = "string",
        ResourceArn = "string",
        Region = "string",
    });
    
    example, err := pinpoint.NewSmsvoicev2ResourcePolicy(ctx, "smsvoicev2ResourcePolicyResource", &pinpoint.Smsvoicev2ResourcePolicyArgs{
    	Policy:      pulumi.String("string"),
    	ResourceArn: pulumi.String("string"),
    	Region:      pulumi.String("string"),
    })
    
    resource "aws_pinpoint_smsvoicev2_resource_policy" "smsvoicev2ResourcePolicyResource" {
      lifecycle {
        create_before_destroy = true
      }
      policy       = "string"
      resource_arn = "string"
      region       = "string"
    }
    
    var smsvoicev2ResourcePolicyResource = new Smsvoicev2ResourcePolicy("smsvoicev2ResourcePolicyResource", Smsvoicev2ResourcePolicyArgs.builder()
        .policy("string")
        .resourceArn("string")
        .region("string")
        .build());
    
    smsvoicev2_resource_policy_resource = aws.pinpoint.Smsvoicev2ResourcePolicy("smsvoicev2ResourcePolicyResource",
        policy="string",
        resource_arn="string",
        region="string")
    
    const smsvoicev2ResourcePolicyResource = new aws.pinpoint.Smsvoicev2ResourcePolicy("smsvoicev2ResourcePolicyResource", {
        policy: "string",
        resourceArn: "string",
        region: "string",
    });
    
    type: aws:pinpoint:Smsvoicev2ResourcePolicy
    properties:
        policy: string
        region: string
        resourceArn: string
    

    Smsvoicev2ResourcePolicy Resource Properties

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

    Inputs

    In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

    The Smsvoicev2ResourcePolicy resource accepts the following input properties:

    Policy string
    Resource-based policy document in JSON format.
    ResourceArn string

    ARN of the End User Messaging SMS resource — phone number, opt-out list, pool, or sender ID — to attach the policy to.

    The following arguments are optional:

    Region string
    Region where this resource will be managed. Defaults to the region set in the provider configuration.
    Policy string
    Resource-based policy document in JSON format.
    ResourceArn string

    ARN of the End User Messaging SMS resource — phone number, opt-out list, pool, or sender ID — to attach the policy to.

    The following arguments are optional:

    Region string
    Region where this resource will be managed. Defaults to the region set in the provider configuration.
    policy string
    Resource-based policy document in JSON format.
    resource_arn string

    ARN of the End User Messaging SMS resource — phone number, opt-out list, pool, or sender ID — to attach the policy to.

    The following arguments are optional:

    region string
    Region where this resource will be managed. Defaults to the region set in the provider configuration.
    policy String
    Resource-based policy document in JSON format.
    resourceArn String

    ARN of the End User Messaging SMS resource — phone number, opt-out list, pool, or sender ID — to attach the policy to.

    The following arguments are optional:

    region String
    Region where this resource will be managed. Defaults to the region set in the provider configuration.
    policy string
    Resource-based policy document in JSON format.
    resourceArn string

    ARN of the End User Messaging SMS resource — phone number, opt-out list, pool, or sender ID — to attach the policy to.

    The following arguments are optional:

    region string
    Region where this resource will be managed. Defaults to the region set in the provider configuration.
    policy str
    Resource-based policy document in JSON format.
    resource_arn str

    ARN of the End User Messaging SMS resource — phone number, opt-out list, pool, or sender ID — to attach the policy to.

    The following arguments are optional:

    region str
    Region where this resource will be managed. Defaults to the region set in the provider configuration.
    policy String
    Resource-based policy document in JSON format.
    resourceArn String

    ARN of the End User Messaging SMS resource — phone number, opt-out list, pool, or sender ID — to attach the policy to.

    The following arguments are optional:

    region String
    Region where this resource will be managed. Defaults to the region set in the provider configuration.

    Outputs

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

    Get an existing Smsvoicev2ResourcePolicy 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?: Smsvoicev2ResourcePolicyState, opts?: CustomResourceOptions): Smsvoicev2ResourcePolicy
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            policy: Optional[str] = None,
            region: Optional[str] = None,
            resource_arn: Optional[str] = None) -> Smsvoicev2ResourcePolicy
    func GetSmsvoicev2ResourcePolicy(ctx *Context, name string, id IDInput, state *Smsvoicev2ResourcePolicyState, opts ...ResourceOption) (*Smsvoicev2ResourcePolicy, error)
    public static Smsvoicev2ResourcePolicy Get(string name, Input<string> id, Smsvoicev2ResourcePolicyState? state, CustomResourceOptions? opts = null)
    public static Smsvoicev2ResourcePolicy get(String name, Output<String> id, Smsvoicev2ResourcePolicyState state, CustomResourceOptions options)
    resources:  _:    type: aws:pinpoint:Smsvoicev2ResourcePolicy    get:      id: ${id}
    import {
      to = aws_pinpoint_smsvoicev2_resource_policy.example
      id = "${id}"
    }
    
    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:
    Policy string
    Resource-based policy document in JSON format.
    Region string
    Region where this resource will be managed. Defaults to the region set in the provider configuration.
    ResourceArn string

    ARN of the End User Messaging SMS resource — phone number, opt-out list, pool, or sender ID — to attach the policy to.

    The following arguments are optional:

    Policy string
    Resource-based policy document in JSON format.
    Region string
    Region where this resource will be managed. Defaults to the region set in the provider configuration.
    ResourceArn string

    ARN of the End User Messaging SMS resource — phone number, opt-out list, pool, or sender ID — to attach the policy to.

    The following arguments are optional:

    policy string
    Resource-based policy document in JSON format.
    region string
    Region where this resource will be managed. Defaults to the region set in the provider configuration.
    resource_arn string

    ARN of the End User Messaging SMS resource — phone number, opt-out list, pool, or sender ID — to attach the policy to.

    The following arguments are optional:

    policy String
    Resource-based policy document in JSON format.
    region String
    Region where this resource will be managed. Defaults to the region set in the provider configuration.
    resourceArn String

    ARN of the End User Messaging SMS resource — phone number, opt-out list, pool, or sender ID — to attach the policy to.

    The following arguments are optional:

    policy string
    Resource-based policy document in JSON format.
    region string
    Region where this resource will be managed. Defaults to the region set in the provider configuration.
    resourceArn string

    ARN of the End User Messaging SMS resource — phone number, opt-out list, pool, or sender ID — to attach the policy to.

    The following arguments are optional:

    policy str
    Resource-based policy document in JSON format.
    region str
    Region where this resource will be managed. Defaults to the region set in the provider configuration.
    resource_arn str

    ARN of the End User Messaging SMS resource — phone number, opt-out list, pool, or sender ID — to attach the policy to.

    The following arguments are optional:

    policy String
    Resource-based policy document in JSON format.
    region String
    Region where this resource will be managed. Defaults to the region set in the provider configuration.
    resourceArn String

    ARN of the End User Messaging SMS resource — phone number, opt-out list, pool, or sender ID — to attach the policy to.

    The following arguments are optional:

    Import

    Identity Schema

    Required

    • resourceArn (String) ARN of the End User Messaging SMS resource the policy is attached to.

    Using pulumi import, import the resource policy using the parent resource ARN. For example:

    $ pulumi import aws:pinpoint/smsvoicev2ResourcePolicy:Smsvoicev2ResourcePolicy example arn:aws:sms-voice:us-east-1:123456789012:phone-number/phone-abcdef0123456789abcdef0123456789
    

    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 aws logo
    Viewing docs for AWS v7.46.0
    published on Thursday, Sep 10, 2026 by Pulumi

      Try Pulumi Cloud free.
      Your team will thank you.

      Start free trial