Resource Share Accepter Args
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
.
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.Provider;
import com.pulumi.aws.ProviderArgs;
import com.pulumi.aws.ram.ResourceShare;
import com.pulumi.aws.ram.ResourceShareArgs;
import com.pulumi.aws.AwsFunctions;
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 com.pulumi.resources.CustomResourceOptions;
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 alternate = new Provider("alternate", ProviderArgs.builder()
.profile("profile1")
.build());
var senderShare = new ResourceShare("senderShare", ResourceShareArgs.builder()
.allowExternalPrincipals(true)
.tags(Map.of("Name", "tf-test-resource-share"))
.build(), CustomResourceOptions.builder()
.provider(aws.alternate())
.build());
final var receiver = AwsFunctions.getCallerIdentity();
var senderInvite = new PrincipalAssociation("senderInvite", PrincipalAssociationArgs.builder()
.principal(receiver.applyValue(getCallerIdentityResult -> getCallerIdentityResult.accountId()))
.resourceShareArn(senderShare.arn())
.build(), CustomResourceOptions.builder()
.provider(aws.alternate())
.build());
var receiverAccept = new ResourceShareAccepter("receiverAccept", ResourceShareAccepterArgs.builder()
.shareArn(senderInvite.resourceShareArn())
.build());
}
}
Import
Resource share accepters can be imported using the resource share ARN, e.g.,
$ pulumi import aws:ram/resourceShareAccepter:ResourceShareAccepter example arn:aws:ram:us-east-1:123456789012:resource-share/c4b56393-e8d9-89d9-6dc9-883752de4767