ResourceShareAccepter class
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)
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 main
import (
"github.com/pulumi/pulumi-aws/sdk/v7/go/aws"
"github.com/pulumi/pulumi-aws/sdk/v7/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
})
}
pulumi {
required_providers {
aws = {
source = "pulumi/aws"
}
}
}
data "aws_getcalleridentity" "receiver" {
}
resource "aws_ram_resourceshare" "sender_share" {
name = "tf-test-resource-share"
allow_external_principals = true
tags = {
"Name" = "tf-test-resource-share"
}
}
resource "aws_ram_principalassociation" "sender_invite" {
principal = data.aws_getcalleridentity.receiver.account_id
resource_share_arn = aws_ram_resourceshare.sender_share.arn
}
resource "aws_ram_resourceshareaccepter" "receiver_accept" {
share_arn = aws_ram_principalassociation.sender_invite.resource_share_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.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.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 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(GetCallerIdentityArgs.builder()
.build());
var senderInvite = new PrincipalAssociation("senderInvite", PrincipalAssociationArgs.builder()
.principal(receiver.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: {}
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
Constructors
-
Creates a new ResourceShareAccepter.
nameThe Pulumi resource name.argsArguments used to configure this ResourceShareAccepter. The set of arguments for ResourceShareAccepter.optionsResource options controlling this resource's behavior. - Creates a typed reference to an existing ResourceShareAccepter resource.
Properties
-
childResources
→ Set<
Resource> -
finalinherited
-
completionSources
↔ Map<
String, IOutputCompletionSource> -
latefinalinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
-
id
↔ Output<
String> -
getter/setter pairinherited
-
invitationArn
↔ Output<
String> -
ARN of the resource share invitation.
latefinal
- isCustom → bool
-
Returns whether this resource is provider-managed.
no setterinherited
- isProtected → bool
-
Returns whether this resource is protected from deletion.
no setterinherited
- isRemote → bool
-
Whether this resource is registered as remote.
no setterinherited
- isResourceReference → bool
-
Whether this instance represents a resource value returned over RPC.
finalinherited
-
receiverAccountId
↔ Output<
String> -
Account ID of the receiver account which accepts the invitation.
latefinal
-
region
↔ Output<
String> -
Region where this resource will be managed. Defaults to the Region set in the provider configuration.
latefinal
-
resources
↔ Output<
List< String> > -
List of the resource ARNs shared via the resource share.
latefinal
-
resourceTransforms
→ List<
ResourceTransform> -
Inherited/explicit async transforms.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
senderAccountId
↔ Output<
String> -
Account ID of the sender account which submits the invitation.
latefinal
-
ARN of the resource share.
latefinal
-
ID of the resource share as displayed in the console.
latefinal
-
Name of the resource share.
latefinal
-
status
↔ Output<
String> -
Status of the resource share (ACTIVE, PENDING, FAILED, DELETING, DELETED).
latefinal
-
transformations
→ List<
ResourceTransformation> -
Inherited/explicit legacy transformations.
no setterinherited
-
urn
↔ Output<
String> -
latefinalinherited
Methods
-
failId(
Object error) → void -
Completes this resource ID with an error when registration fails.
inherited
-
failOutputs(
Object error) → void -
Completes all output properties with
error.inherited -
failUrn(
Object error) → void -
Completes this resource URN with an error when registration fails.
inherited
-
getProvider(
String moduleMember) → ProviderResource? -
Returns provider for
moduleMember's package, if configured.inherited -
getResourceName(
) → String -
Returns this resource's logical name.
inherited
-
getResourceType(
) → String -
Returns this resource's Pulumi type token.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
registerOutput<
T> (String propertyName, {Object? decoder(Object?)?, bool isSecret = false}) → Output< T> -
Registers a dynamic output property for this resource.
inherited
-
resolveId(
String? value, {required bool isKnown}) → void -
Resolves the provider-assigned ID for this resource.
inherited
-
resolveOutputs(
Struct outputs) → void -
Resolves all output properties from a monitor response payload.
inherited
-
resolveUrn(
String value) → void -
Resolves this resource's URN once assigned by the engine.
inherited
-
serializeProperties(
Map< String, dynamic> properties) → Future<Struct> -
Serializes resource properties for RPC transmission.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
get(
String name, Input< String> id, {ResourceShareAccepterState? state, CustomResourceOptions? options}) → ResourceShareAccepter -
Gets an existing ResourceShareAccepter resource's state with the given
nameandid.