1. Packages
  2. AWS
  3. API Docs
  4. ram
  5. PrincipalAssociation
AWS v6.54.2 published on Wednesday, Oct 2, 2024 by Pulumi

aws.ram.PrincipalAssociation

Explore with Pulumi AI

aws logo
AWS v6.54.2 published on Wednesday, Oct 2, 2024 by Pulumi

    Provides a Resource Access Manager (RAM) principal association. Depending if RAM Sharing with AWS Organizations is enabled, the RAM behavior with different principal types changes.

    When RAM Sharing with AWS Organizations is enabled:

    • For AWS Account ID, Organization, and Organizational Unit principals within the same AWS Organization, no resource share invitation is sent and resources become available automatically after creating the association.
    • For AWS Account ID principals outside the AWS Organization, a resource share invitation is sent and must be accepted before resources become available. See the aws.ram.ResourceShareAccepter resource to accept these invitations.

    When RAM Sharing with AWS Organizations is not enabled:

    • Organization and Organizational Unit principals cannot be used.
    • For AWS Account ID principals, a resource share invitation is sent and must be accepted before resources become available. See the aws.ram.ResourceShareAccepter resource to accept these invitations.

    Example Usage

    AWS Account ID

    import * as pulumi from "@pulumi/pulumi";
    import * as aws from "@pulumi/aws";
    
    const example = new aws.ram.ResourceShare("example", {allowExternalPrincipals: true});
    const examplePrincipalAssociation = new aws.ram.PrincipalAssociation("example", {
        principal: "111111111111",
        resourceShareArn: example.arn,
    });
    
    import pulumi
    import pulumi_aws as aws
    
    example = aws.ram.ResourceShare("example", allow_external_principals=True)
    example_principal_association = aws.ram.PrincipalAssociation("example",
        principal="111111111111",
        resource_share_arn=example.arn)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ram"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		example, err := ram.NewResourceShare(ctx, "example", &ram.ResourceShareArgs{
    			AllowExternalPrincipals: pulumi.Bool(true),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = ram.NewPrincipalAssociation(ctx, "example", &ram.PrincipalAssociationArgs{
    			Principal:        pulumi.String("111111111111"),
    			ResourceShareArn: example.Arn,
    		})
    		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.Ram.ResourceShare("example", new()
        {
            AllowExternalPrincipals = true,
        });
    
        var examplePrincipalAssociation = new Aws.Ram.PrincipalAssociation("example", new()
        {
            Principal = "111111111111",
            ResourceShareArn = example.Arn,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.aws.ram.ResourceShare;
    import com.pulumi.aws.ram.ResourceShareArgs;
    import com.pulumi.aws.ram.PrincipalAssociation;
    import com.pulumi.aws.ram.PrincipalAssociationArgs;
    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 ResourceShare("example", ResourceShareArgs.builder()
                .allowExternalPrincipals(true)
                .build());
    
            var examplePrincipalAssociation = new PrincipalAssociation("examplePrincipalAssociation", PrincipalAssociationArgs.builder()
                .principal("111111111111")
                .resourceShareArn(example.arn())
                .build());
    
        }
    }
    
    resources:
      example:
        type: aws:ram:ResourceShare
        properties:
          allowExternalPrincipals: true
      examplePrincipalAssociation:
        type: aws:ram:PrincipalAssociation
        name: example
        properties:
          principal: '111111111111'
          resourceShareArn: ${example.arn}
    

    AWS Organization

    import * as pulumi from "@pulumi/pulumi";
    import * as aws from "@pulumi/aws";
    
    const example = new aws.ram.PrincipalAssociation("example", {
        principal: exampleAwsOrganizationsOrganization.arn,
        resourceShareArn: exampleAwsRamResourceShare.arn,
    });
    
    import pulumi
    import pulumi_aws as aws
    
    example = aws.ram.PrincipalAssociation("example",
        principal=example_aws_organizations_organization["arn"],
        resource_share_arn=example_aws_ram_resource_share["arn"])
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ram"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := ram.NewPrincipalAssociation(ctx, "example", &ram.PrincipalAssociationArgs{
    			Principal:        pulumi.Any(exampleAwsOrganizationsOrganization.Arn),
    			ResourceShareArn: pulumi.Any(exampleAwsRamResourceShare.Arn),
    		})
    		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.Ram.PrincipalAssociation("example", new()
        {
            Principal = exampleAwsOrganizationsOrganization.Arn,
            ResourceShareArn = exampleAwsRamResourceShare.Arn,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.aws.ram.PrincipalAssociation;
    import com.pulumi.aws.ram.PrincipalAssociationArgs;
    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 PrincipalAssociation("example", PrincipalAssociationArgs.builder()
                .principal(exampleAwsOrganizationsOrganization.arn())
                .resourceShareArn(exampleAwsRamResourceShare.arn())
                .build());
    
        }
    }
    
    resources:
      example:
        type: aws:ram:PrincipalAssociation
        properties:
          principal: ${exampleAwsOrganizationsOrganization.arn}
          resourceShareArn: ${exampleAwsRamResourceShare.arn}
    

    Create PrincipalAssociation Resource

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

    Constructor syntax

    new PrincipalAssociation(name: string, args: PrincipalAssociationArgs, opts?: CustomResourceOptions);
    @overload
    def PrincipalAssociation(resource_name: str,
                             args: PrincipalAssociationArgs,
                             opts: Optional[ResourceOptions] = None)
    
    @overload
    def PrincipalAssociation(resource_name: str,
                             opts: Optional[ResourceOptions] = None,
                             principal: Optional[str] = None,
                             resource_share_arn: Optional[str] = None)
    func NewPrincipalAssociation(ctx *Context, name string, args PrincipalAssociationArgs, opts ...ResourceOption) (*PrincipalAssociation, error)
    public PrincipalAssociation(string name, PrincipalAssociationArgs args, CustomResourceOptions? opts = null)
    public PrincipalAssociation(String name, PrincipalAssociationArgs args)
    public PrincipalAssociation(String name, PrincipalAssociationArgs args, CustomResourceOptions options)
    
    type: aws:ram:PrincipalAssociation
    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 PrincipalAssociationArgs
    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 PrincipalAssociationArgs
    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 PrincipalAssociationArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args PrincipalAssociationArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args PrincipalAssociationArgs
    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 principalAssociationResource = new Aws.Ram.PrincipalAssociation("principalAssociationResource", new()
    {
        Principal = "string",
        ResourceShareArn = "string",
    });
    
    example, err := ram.NewPrincipalAssociation(ctx, "principalAssociationResource", &ram.PrincipalAssociationArgs{
    	Principal:        pulumi.String("string"),
    	ResourceShareArn: pulumi.String("string"),
    })
    
    var principalAssociationResource = new PrincipalAssociation("principalAssociationResource", PrincipalAssociationArgs.builder()
        .principal("string")
        .resourceShareArn("string")
        .build());
    
    principal_association_resource = aws.ram.PrincipalAssociation("principalAssociationResource",
        principal="string",
        resource_share_arn="string")
    
    const principalAssociationResource = new aws.ram.PrincipalAssociation("principalAssociationResource", {
        principal: "string",
        resourceShareArn: "string",
    });
    
    type: aws:ram:PrincipalAssociation
    properties:
        principal: string
        resourceShareArn: string
    

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

    Principal string
    The principal to associate with the resource share. Possible values are an AWS account ID, an AWS Organizations Organization ARN, or an AWS Organizations Organization Unit ARN.
    ResourceShareArn string
    The Amazon Resource Name (ARN) of the resource share.
    Principal string
    The principal to associate with the resource share. Possible values are an AWS account ID, an AWS Organizations Organization ARN, or an AWS Organizations Organization Unit ARN.
    ResourceShareArn string
    The Amazon Resource Name (ARN) of the resource share.
    principal String
    The principal to associate with the resource share. Possible values are an AWS account ID, an AWS Organizations Organization ARN, or an AWS Organizations Organization Unit ARN.
    resourceShareArn String
    The Amazon Resource Name (ARN) of the resource share.
    principal string
    The principal to associate with the resource share. Possible values are an AWS account ID, an AWS Organizations Organization ARN, or an AWS Organizations Organization Unit ARN.
    resourceShareArn string
    The Amazon Resource Name (ARN) of the resource share.
    principal str
    The principal to associate with the resource share. Possible values are an AWS account ID, an AWS Organizations Organization ARN, or an AWS Organizations Organization Unit ARN.
    resource_share_arn str
    The Amazon Resource Name (ARN) of the resource share.
    principal String
    The principal to associate with the resource share. Possible values are an AWS account ID, an AWS Organizations Organization ARN, or an AWS Organizations Organization Unit ARN.
    resourceShareArn String
    The Amazon Resource Name (ARN) of the resource share.

    Outputs

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

    Get an existing PrincipalAssociation 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?: PrincipalAssociationState, opts?: CustomResourceOptions): PrincipalAssociation
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            principal: Optional[str] = None,
            resource_share_arn: Optional[str] = None) -> PrincipalAssociation
    func GetPrincipalAssociation(ctx *Context, name string, id IDInput, state *PrincipalAssociationState, opts ...ResourceOption) (*PrincipalAssociation, error)
    public static PrincipalAssociation Get(string name, Input<string> id, PrincipalAssociationState? state, CustomResourceOptions? opts = null)
    public static PrincipalAssociation get(String name, Output<String> id, PrincipalAssociationState 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:
    Principal string
    The principal to associate with the resource share. Possible values are an AWS account ID, an AWS Organizations Organization ARN, or an AWS Organizations Organization Unit ARN.
    ResourceShareArn string
    The Amazon Resource Name (ARN) of the resource share.
    Principal string
    The principal to associate with the resource share. Possible values are an AWS account ID, an AWS Organizations Organization ARN, or an AWS Organizations Organization Unit ARN.
    ResourceShareArn string
    The Amazon Resource Name (ARN) of the resource share.
    principal String
    The principal to associate with the resource share. Possible values are an AWS account ID, an AWS Organizations Organization ARN, or an AWS Organizations Organization Unit ARN.
    resourceShareArn String
    The Amazon Resource Name (ARN) of the resource share.
    principal string
    The principal to associate with the resource share. Possible values are an AWS account ID, an AWS Organizations Organization ARN, or an AWS Organizations Organization Unit ARN.
    resourceShareArn string
    The Amazon Resource Name (ARN) of the resource share.
    principal str
    The principal to associate with the resource share. Possible values are an AWS account ID, an AWS Organizations Organization ARN, or an AWS Organizations Organization Unit ARN.
    resource_share_arn str
    The Amazon Resource Name (ARN) of the resource share.
    principal String
    The principal to associate with the resource share. Possible values are an AWS account ID, an AWS Organizations Organization ARN, or an AWS Organizations Organization Unit ARN.
    resourceShareArn String
    The Amazon Resource Name (ARN) of the resource share.

    Import

    Using pulumi import, import RAM Principal Associations using their Resource Share ARN and the principal separated by a comma. For example:

    $ pulumi import aws:ram/principalAssociation:PrincipalAssociation example arn:aws:ram:eu-west-1:123456789012:resource-share/73da1ab9-b94a-4ba3-8eb4-45917f7f4b12,123456789012
    

    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 v6.54.2 published on Wednesday, Oct 2, 2024 by Pulumi