@pulumi/aws
Version:
A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.
154 lines • 7.33 kB
JavaScript
;
// *** 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.AccountAssignment = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* Provides a Single Sign-On (SSO) Account Assignment resource
*
* ## Example Usage
*
* ### Basic Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const example = aws.ssoadmin.getInstances({});
* const exampleGetPermissionSet = example.then(example => aws.ssoadmin.getPermissionSet({
* instanceArn: example.arns?.[0],
* name: "AWSReadOnlyAccess",
* }));
* const exampleGetGroup = example.then(example => aws.identitystore.getGroup({
* identityStoreId: example.identityStoreIds?.[0],
* alternateIdentifier: {
* uniqueAttribute: {
* attributePath: "DisplayName",
* attributeValue: "ExampleGroup",
* },
* },
* }));
* const exampleAccountAssignment = new aws.ssoadmin.AccountAssignment("example", {
* instanceArn: example.then(example => example.arns?.[0]),
* permissionSetArn: exampleGetPermissionSet.then(exampleGetPermissionSet => exampleGetPermissionSet.arn),
* principalId: exampleGetGroup.then(exampleGetGroup => exampleGetGroup.groupId),
* principalType: "GROUP",
* targetId: "123456789012",
* targetType: "AWS_ACCOUNT",
* });
* ```
*
* ### With Managed Policy Attachment
*
* > Because destruction of a managed policy attachment resource also re-provisions the associated permission set to all accounts, explicitly indicating the dependency with the account assignment resource via the `dependsOn` meta argument is necessary to ensure proper deletion order when these resources are used together.
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const example = aws.ssoadmin.getInstances({});
* const examplePermissionSet = new aws.ssoadmin.PermissionSet("example", {
* name: "Example",
* instanceArn: example.then(example => example.arns?.[0]),
* });
* const exampleGroup = new aws.identitystore.Group("example", {
* identityStoreId: example.then(example => example.identityStoreIds?.[0]),
* displayName: "Admin",
* description: "Admin Group",
* });
* const accountAssignment = new aws.ssoadmin.AccountAssignment("account_assignment", {
* instanceArn: example.then(example => example.arns?.[0]),
* permissionSetArn: examplePermissionSet.arn,
* principalId: exampleGroup.groupId,
* principalType: "GROUP",
* targetId: "123456789012",
* targetType: "AWS_ACCOUNT",
* });
* const exampleManagedPolicyAttachment = new aws.ssoadmin.ManagedPolicyAttachment("example", {
* instanceArn: example.then(example => example.arns?.[0]),
* managedPolicyArn: "arn:aws:iam::aws:policy/AlexaForBusinessDeviceSetup",
* permissionSetArn: examplePermissionSet.arn,
* }, {
* dependsOn: [exampleAwsSsoadminAccountAssignment],
* });
* ```
*
* ## Import
*
* Using `pulumi import`, import SSO Account Assignments using the `principal_id`, `principal_type`, `target_id`, `target_type`, `permission_set_arn`, `instance_arn` separated by commas (`,`). For example:
*
* ```sh
* $ pulumi import aws:ssoadmin/accountAssignment:AccountAssignment example f81d4fae-7dec-11d0-a765-00a0c91e6bf6,GROUP,1234567890,AWS_ACCOUNT,arn:aws:sso:::permissionSet/ssoins-0123456789abcdef/ps-0123456789abcdef,arn:aws:sso:::instance/ssoins-0123456789abcdef
* ```
*/
class AccountAssignment extends pulumi.CustomResource {
/**
* Get an existing AccountAssignment 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 AccountAssignment(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of AccountAssignment. 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'] === AccountAssignment.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["instanceArn"] = state ? state.instanceArn : undefined;
resourceInputs["permissionSetArn"] = state ? state.permissionSetArn : undefined;
resourceInputs["principalId"] = state ? state.principalId : undefined;
resourceInputs["principalType"] = state ? state.principalType : undefined;
resourceInputs["region"] = state ? state.region : undefined;
resourceInputs["targetId"] = state ? state.targetId : undefined;
resourceInputs["targetType"] = state ? state.targetType : undefined;
}
else {
const args = argsOrState;
if ((!args || args.instanceArn === undefined) && !opts.urn) {
throw new Error("Missing required property 'instanceArn'");
}
if ((!args || args.permissionSetArn === undefined) && !opts.urn) {
throw new Error("Missing required property 'permissionSetArn'");
}
if ((!args || args.principalId === undefined) && !opts.urn) {
throw new Error("Missing required property 'principalId'");
}
if ((!args || args.principalType === undefined) && !opts.urn) {
throw new Error("Missing required property 'principalType'");
}
if ((!args || args.targetId === undefined) && !opts.urn) {
throw new Error("Missing required property 'targetId'");
}
resourceInputs["instanceArn"] = args ? args.instanceArn : undefined;
resourceInputs["permissionSetArn"] = args ? args.permissionSetArn : undefined;
resourceInputs["principalId"] = args ? args.principalId : undefined;
resourceInputs["principalType"] = args ? args.principalType : undefined;
resourceInputs["region"] = args ? args.region : undefined;
resourceInputs["targetId"] = args ? args.targetId : undefined;
resourceInputs["targetType"] = args ? args.targetType : undefined;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(AccountAssignment.__pulumiType, name, resourceInputs, opts);
}
}
exports.AccountAssignment = AccountAssignment;
/** @internal */
AccountAssignment.__pulumiType = 'aws:ssoadmin/accountAssignment:AccountAssignment';
//# sourceMappingURL=accountAssignment.js.map