UNPKG

@pulumi/aws

Version:

A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.

107 lines 4.96 kB
"use strict"; // *** WARNING: this file was generated by pulumi-language-nodejs. *** // *** Do not edit by hand unless you're certain you know what you are doing! *** Object.defineProperty(exports, "__esModule", { value: true }); exports.PrincipalAssociation = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("../utilities"); /** * Provides a Resource Access Manager (RAM) principal association. Depending if [RAM Sharing with AWS Organizations is enabled](https://docs.aws.amazon.com/ram/latest/userguide/getting-started-sharing.html#getting-started-sharing-orgs), 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 * * ```typescript * 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, * }); * ``` * * ### AWS Organization * * ```typescript * 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 * * Using `pulumi import`, import RAM Principal Associations using their Resource Share ARN and the `principal` separated by a comma. For example: * * ```sh * $ pulumi import aws:ram/principalAssociation:PrincipalAssociation example arn:aws:ram:eu-west-1:123456789012:resource-share/73da1ab9-b94a-4ba3-8eb4-45917f7f4b12,123456789012 * ``` */ class PrincipalAssociation extends pulumi.CustomResource { /** * Get an existing PrincipalAssociation resource's state with the given name, ID, and optional extra * properties used to qualify the lookup. * * @param name The _unique_ name of the resulting resource. * @param id The _unique_ provider ID of the resource to lookup. * @param state Any extra arguments used during the lookup. * @param opts Optional settings to control the behavior of the CustomResource. */ static get(name, id, state, opts) { return new PrincipalAssociation(name, state, { ...opts, id: id }); } /** * Returns true if the given object is an instance of PrincipalAssociation. This is designed to work even * when multiple copies of the Pulumi SDK have been loaded into the same process. */ static isInstance(obj) { if (obj === undefined || obj === null) { return false; } return obj['__pulumiType'] === PrincipalAssociation.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["principal"] = state?.principal; resourceInputs["region"] = state?.region; resourceInputs["resourceShareArn"] = state?.resourceShareArn; } else { const args = argsOrState; if (args?.principal === undefined && !opts.urn) { throw new Error("Missing required property 'principal'"); } if (args?.resourceShareArn === undefined && !opts.urn) { throw new Error("Missing required property 'resourceShareArn'"); } resourceInputs["principal"] = args?.principal; resourceInputs["region"] = args?.region; resourceInputs["resourceShareArn"] = args?.resourceShareArn; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(PrincipalAssociation.__pulumiType, name, resourceInputs, opts); } } exports.PrincipalAssociation = PrincipalAssociation; /** @internal */ PrincipalAssociation.__pulumiType = 'aws:ram/principalAssociation:PrincipalAssociation'; //# sourceMappingURL=principalAssociation.js.map