1. Packages
  2. AWS
  3. API Docs
  4. ram
  5. ResourceShareAccepter
AWS v6.60.0 published on Tuesday, Nov 19, 2024 by Pulumi

aws.ram.ResourceShareAccepter

Explore with Pulumi AI

aws logo
AWS v6.60.0 published on Tuesday, Nov 19, 2024 by Pulumi

    Manage accepting a Resource Access Manager (RAM) Resource Share invitation. From a receiver AWS account, accept an invitation to share resources that were shared by a sender AWS account. To create a resource share in the sender, see the aws.ram.ResourceShare resource.

    Note: If both AWS accounts are in the same Organization and RAM Sharing with AWS Organizations is enabled, this resource is not necessary as RAM Resource Share invitations are not used.

    Example Usage

    This configuration provides an example of using multiple AWS providers to configure two different AWS accounts. In the sender account, the configuration creates a aws.ram.ResourceShare and uses a data source in the receiver account to create a aws.ram.PrincipalAssociation resource with the receiver’s account ID. In the receiver account, the configuration accepts the invitation to share resources with the aws.ram.ResourceShareAccepter.

    import * as pulumi from "@pulumi/pulumi";
    import * as aws from "@pulumi/aws";
    
    const senderShare = new aws.ram.ResourceShare("sender_share", {
        name: "tf-test-resource-share",
        allowExternalPrincipals: true,
        tags: {
            Name: "tf-test-resource-share",
        },
    });
    const receiver = aws.getCallerIdentity({});
    const senderInvite = new aws.ram.PrincipalAssociation("sender_invite", {
        principal: receiver.then(receiver => receiver.accountId),
        resourceShareArn: senderShare.arn,
    });
    const receiverAccept = new aws.ram.ResourceShareAccepter("receiver_accept", {shareArn: senderInvite.resourceShareArn});
    
    import pulumi
    import pulumi_aws as aws
    
    sender_share = aws.ram.ResourceShare("sender_share",
        name="tf-test-resource-share",
        allow_external_principals=True,
        tags={
            "Name": "tf-test-resource-share",
        })
    receiver = aws.get_caller_identity()
    sender_invite = aws.ram.PrincipalAssociation("sender_invite",
        principal=receiver.account_id,
        resource_share_arn=sender_share.arn)
    receiver_accept = aws.ram.ResourceShareAccepter("receiver_accept", share_arn=sender_invite.resource_share_arn)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws"
    	"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 {
    		senderShare, err := ram.NewResourceShare(ctx, "sender_share", &ram.ResourceShareArgs{
    			Name:                    pulumi.String("tf-test-resource-share"),
    			AllowExternalPrincipals: pulumi.Bool(true),
    			Tags: pulumi.StringMap{
    				"Name": pulumi.String("tf-test-resource-share"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		receiver, err := aws.GetCallerIdentity(ctx, &aws.GetCallerIdentityArgs{}, nil)
    		if err != nil {
    			return err
    		}
    		senderInvite, err := ram.NewPrincipalAssociation(ctx, "sender_invite", &ram.PrincipalAssociationArgs{
    			Principal:        pulumi.String(receiver.AccountId),
    			ResourceShareArn: senderShare.Arn,
    		})
    		if err != nil {
    			return err
    		}
    		_, err = ram.NewResourceShareAccepter(ctx, "receiver_accept", &ram.ResourceShareAccepterArgs{
    			ShareArn: senderInvite.ResourceShareArn,
    		})
    		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 senderShare = new Aws.Ram.ResourceShare("sender_share", new()
        {
            Name = "tf-test-resource-share",
            AllowExternalPrincipals = true,
            Tags = 
            {
                { "Name", "tf-test-resource-share" },
            },
        });
    
        var receiver = Aws.GetCallerIdentity.Invoke();
    
        var senderInvite = new Aws.Ram.PrincipalAssociation("sender_invite", new()
        {
            Principal = receiver.Apply(getCallerIdentityResult => getCallerIdentityResult.AccountId),
            ResourceShareArn = senderShare.Arn,
        });
    
        var receiverAccept = new Aws.Ram.ResourceShareAccepter("receiver_accept", new()
        {
            ShareArn = senderInvite.ResourceShareArn,
        });
    
    });
    
    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.AwsFunctions;
    import com.pulumi.aws.inputs.GetCallerIdentityArgs;
    import com.pulumi.aws.ram.PrincipalAssociation;
    import com.pulumi.aws.ram.PrincipalAssociationArgs;
    import com.pulumi.aws.ram.ResourceShareAccepter;
    import com.pulumi.aws.ram.ResourceShareAccepterArgs;
    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 senderShare = new ResourceShare("senderShare", ResourceShareArgs.builder()
                .name("tf-test-resource-share")
                .allowExternalPrincipals(true)
                .tags(Map.of("Name", "tf-test-resource-share"))
                .build());
    
            final var receiver = AwsFunctions.getCallerIdentity();
    
            var senderInvite = new PrincipalAssociation("senderInvite", PrincipalAssociationArgs.builder()
                .principal(receiver.applyValue(getCallerIdentityResult -> getCallerIdentityResult.accountId()))
                .resourceShareArn(senderShare.arn())
                .build());
    
            var receiverAccept = new ResourceShareAccepter("receiverAccept", ResourceShareAccepterArgs.builder()
                .shareArn(senderInvite.resourceShareArn())
                .build());
    
        }
    }
    
    resources:
      senderShare:
        type: aws:ram:ResourceShare
        name: sender_share
        properties:
          name: tf-test-resource-share
          allowExternalPrincipals: true
          tags:
            Name: tf-test-resource-share
      senderInvite:
        type: aws:ram:PrincipalAssociation
        name: sender_invite
        properties:
          principal: ${receiver.accountId}
          resourceShareArn: ${senderShare.arn}
      receiverAccept:
        type: aws:ram:ResourceShareAccepter
        name: receiver_accept
        properties:
          shareArn: ${senderInvite.resourceShareArn}
    variables:
      receiver:
        fn::invoke:
          Function: aws:getCallerIdentity
          Arguments: {}
    

    Create ResourceShareAccepter Resource

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

    Constructor syntax

    new ResourceShareAccepter(name: string, args: ResourceShareAccepterArgs, opts?: CustomResourceOptions);
    @overload
    def ResourceShareAccepter(resource_name: str,
                              args: ResourceShareAccepterArgs,
                              opts: Optional[ResourceOptions] = None)
    
    @overload
    def ResourceShareAccepter(resource_name: str,
                              opts: Optional[ResourceOptions] = None,
                              share_arn: Optional[str] = None)
    func NewResourceShareAccepter(ctx *Context, name string, args ResourceShareAccepterArgs, opts ...ResourceOption) (*ResourceShareAccepter, error)
    public ResourceShareAccepter(string name, ResourceShareAccepterArgs args, CustomResourceOptions? opts = null)
    public ResourceShareAccepter(String name, ResourceShareAccepterArgs args)
    public ResourceShareAccepter(String name, ResourceShareAccepterArgs args, CustomResourceOptions options)
    
    type: aws:ram:ResourceShareAccepter
    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 ResourceShareAccepterArgs
    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 ResourceShareAccepterArgs
    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 ResourceShareAccepterArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args ResourceShareAccepterArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args ResourceShareAccepterArgs
    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 resourceShareAccepterResource = new Aws.Ram.ResourceShareAccepter("resourceShareAccepterResource", new()
    {
        ShareArn = "string",
    });
    
    example, err := ram.NewResourceShareAccepter(ctx, "resourceShareAccepterResource", &ram.ResourceShareAccepterArgs{
    	ShareArn: pulumi.String("string"),
    })
    
    var resourceShareAccepterResource = new ResourceShareAccepter("resourceShareAccepterResource", ResourceShareAccepterArgs.builder()
        .shareArn("string")
        .build());
    
    resource_share_accepter_resource = aws.ram.ResourceShareAccepter("resourceShareAccepterResource", share_arn="string")
    
    const resourceShareAccepterResource = new aws.ram.ResourceShareAccepter("resourceShareAccepterResource", {shareArn: "string"});
    
    type: aws:ram:ResourceShareAccepter
    properties:
        shareArn: string
    

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

    ShareArn string
    The ARN of the resource share.
    ShareArn string
    The ARN of the resource share.
    shareArn String
    The ARN of the resource share.
    shareArn string
    The ARN of the resource share.
    share_arn str
    The ARN of the resource share.
    shareArn String
    The ARN of the resource share.

    Outputs

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

    Id string
    The provider-assigned unique ID for this managed resource.
    InvitationArn string
    The ARN of the resource share invitation.
    ReceiverAccountId string
    The account ID of the receiver account which accepts the invitation.
    Resources List<string>
    A list of the resource ARNs shared via the resource share.
    SenderAccountId string
    The account ID of the sender account which submits the invitation.
    ShareId string
    The ID of the resource share as displayed in the console.
    ShareName string
    The name of the resource share.
    Status string
    The status of the resource share (ACTIVE, PENDING, FAILED, DELETING, DELETED).
    Id string
    The provider-assigned unique ID for this managed resource.
    InvitationArn string
    The ARN of the resource share invitation.
    ReceiverAccountId string
    The account ID of the receiver account which accepts the invitation.
    Resources []string
    A list of the resource ARNs shared via the resource share.
    SenderAccountId string
    The account ID of the sender account which submits the invitation.
    ShareId string
    The ID of the resource share as displayed in the console.
    ShareName string
    The name of the resource share.
    Status string
    The status of the resource share (ACTIVE, PENDING, FAILED, DELETING, DELETED).
    id String
    The provider-assigned unique ID for this managed resource.
    invitationArn String
    The ARN of the resource share invitation.
    receiverAccountId String
    The account ID of the receiver account which accepts the invitation.
    resources List<String>
    A list of the resource ARNs shared via the resource share.
    senderAccountId String
    The account ID of the sender account which submits the invitation.
    shareId String
    The ID of the resource share as displayed in the console.
    shareName String
    The name of the resource share.
    status String
    The status of the resource share (ACTIVE, PENDING, FAILED, DELETING, DELETED).
    id string
    The provider-assigned unique ID for this managed resource.
    invitationArn string
    The ARN of the resource share invitation.
    receiverAccountId string
    The account ID of the receiver account which accepts the invitation.
    resources string[]
    A list of the resource ARNs shared via the resource share.
    senderAccountId string
    The account ID of the sender account which submits the invitation.
    shareId string
    The ID of the resource share as displayed in the console.
    shareName string
    The name of the resource share.
    status string
    The status of the resource share (ACTIVE, PENDING, FAILED, DELETING, DELETED).
    id str
    The provider-assigned unique ID for this managed resource.
    invitation_arn str
    The ARN of the resource share invitation.
    receiver_account_id str
    The account ID of the receiver account which accepts the invitation.
    resources Sequence[str]
    A list of the resource ARNs shared via the resource share.
    sender_account_id str
    The account ID of the sender account which submits the invitation.
    share_id str
    The ID of the resource share as displayed in the console.
    share_name str
    The name of the resource share.
    status str
    The status of the resource share (ACTIVE, PENDING, FAILED, DELETING, DELETED).
    id String
    The provider-assigned unique ID for this managed resource.
    invitationArn String
    The ARN of the resource share invitation.
    receiverAccountId String
    The account ID of the receiver account which accepts the invitation.
    resources List<String>
    A list of the resource ARNs shared via the resource share.
    senderAccountId String
    The account ID of the sender account which submits the invitation.
    shareId String
    The ID of the resource share as displayed in the console.
    shareName String
    The name of the resource share.
    status String
    The status of the resource share (ACTIVE, PENDING, FAILED, DELETING, DELETED).

    Look up Existing ResourceShareAccepter Resource

    Get an existing ResourceShareAccepter 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?: ResourceShareAccepterState, opts?: CustomResourceOptions): ResourceShareAccepter
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            invitation_arn: Optional[str] = None,
            receiver_account_id: Optional[str] = None,
            resources: Optional[Sequence[str]] = None,
            sender_account_id: Optional[str] = None,
            share_arn: Optional[str] = None,
            share_id: Optional[str] = None,
            share_name: Optional[str] = None,
            status: Optional[str] = None) -> ResourceShareAccepter
    func GetResourceShareAccepter(ctx *Context, name string, id IDInput, state *ResourceShareAccepterState, opts ...ResourceOption) (*ResourceShareAccepter, error)
    public static ResourceShareAccepter Get(string name, Input<string> id, ResourceShareAccepterState? state, CustomResourceOptions? opts = null)
    public static ResourceShareAccepter get(String name, Output<String> id, ResourceShareAccepterState 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:
    InvitationArn string
    The ARN of the resource share invitation.
    ReceiverAccountId string
    The account ID of the receiver account which accepts the invitation.
    Resources List<string>
    A list of the resource ARNs shared via the resource share.
    SenderAccountId string
    The account ID of the sender account which submits the invitation.
    ShareArn string
    The ARN of the resource share.
    ShareId string
    The ID of the resource share as displayed in the console.
    ShareName string
    The name of the resource share.
    Status string
    The status of the resource share (ACTIVE, PENDING, FAILED, DELETING, DELETED).
    InvitationArn string
    The ARN of the resource share invitation.
    ReceiverAccountId string
    The account ID of the receiver account which accepts the invitation.
    Resources []string
    A list of the resource ARNs shared via the resource share.
    SenderAccountId string
    The account ID of the sender account which submits the invitation.
    ShareArn string
    The ARN of the resource share.
    ShareId string
    The ID of the resource share as displayed in the console.
    ShareName string
    The name of the resource share.
    Status string
    The status of the resource share (ACTIVE, PENDING, FAILED, DELETING, DELETED).
    invitationArn String
    The ARN of the resource share invitation.
    receiverAccountId String
    The account ID of the receiver account which accepts the invitation.
    resources List<String>
    A list of the resource ARNs shared via the resource share.
    senderAccountId String
    The account ID of the sender account which submits the invitation.
    shareArn String
    The ARN of the resource share.
    shareId String
    The ID of the resource share as displayed in the console.
    shareName String
    The name of the resource share.
    status String
    The status of the resource share (ACTIVE, PENDING, FAILED, DELETING, DELETED).
    invitationArn string
    The ARN of the resource share invitation.
    receiverAccountId string
    The account ID of the receiver account which accepts the invitation.
    resources string[]
    A list of the resource ARNs shared via the resource share.
    senderAccountId string
    The account ID of the sender account which submits the invitation.
    shareArn string
    The ARN of the resource share.
    shareId string
    The ID of the resource share as displayed in the console.
    shareName string
    The name of the resource share.
    status string
    The status of the resource share (ACTIVE, PENDING, FAILED, DELETING, DELETED).
    invitation_arn str
    The ARN of the resource share invitation.
    receiver_account_id str
    The account ID of the receiver account which accepts the invitation.
    resources Sequence[str]
    A list of the resource ARNs shared via the resource share.
    sender_account_id str
    The account ID of the sender account which submits the invitation.
    share_arn str
    The ARN of the resource share.
    share_id str
    The ID of the resource share as displayed in the console.
    share_name str
    The name of the resource share.
    status str
    The status of the resource share (ACTIVE, PENDING, FAILED, DELETING, DELETED).
    invitationArn String
    The ARN of the resource share invitation.
    receiverAccountId String
    The account ID of the receiver account which accepts the invitation.
    resources List<String>
    A list of the resource ARNs shared via the resource share.
    senderAccountId String
    The account ID of the sender account which submits the invitation.
    shareArn String
    The ARN of the resource share.
    shareId String
    The ID of the resource share as displayed in the console.
    shareName String
    The name of the resource share.
    status String
    The status of the resource share (ACTIVE, PENDING, FAILED, DELETING, DELETED).

    Import

    Using pulumi import, import resource share accepters using the resource share ARN. For example:

    $ pulumi import aws:ram/resourceShareAccepter:ResourceShareAccepter example arn:aws:ram:us-east-1:123456789012:resource-share/c4b56393-e8d9-89d9-6dc9-883752de4767
    

    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.60.0 published on Tuesday, Nov 19, 2024 by Pulumi