UNPKG

@pulumi/aws

Version:

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

122 lines 4.19 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.PolicyAttachment = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("../utilities"); /** * Provides a resource to attach an AWS Organizations policy to an organization account, root, or unit. * * ## Example Usage * * ### Organization Account * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const account = new aws.organizations.PolicyAttachment("account", { * policyId: example.id, * targetId: "123456789012", * }); * ``` * * ### Organization Root * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const root = new aws.organizations.PolicyAttachment("root", { * policyId: example.id, * targetId: exampleAwsOrganizationsOrganization.roots[0].id, * }); * ``` * * ### Organization Unit * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const unit = new aws.organizations.PolicyAttachment("unit", { * policyId: example.id, * targetId: exampleAwsOrganizationsOrganizationalUnit.id, * }); * ``` * * ## Import * * ### Identity Schema * * #### Required * * * `policy_id` (String) Organizations policy ID. * * * `target_id` (String) Organizations target ID (account, OU, or root). * * #### Optional * * * `account_id` (String) AWS Account where this resource is managed. * * Using `pulumi import`, import `aws_organizations_policy_attachment` using the target ID and policy ID. For example: * * With an account target: * * console * * % pulumi import aws_organizations_policy_attachment.example 123456789012:p-12345678 */ class PolicyAttachment extends pulumi.CustomResource { /** * Get an existing PolicyAttachment 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 PolicyAttachment(name, state, { ...opts, id: id }); } /** * Returns true if the given object is an instance of PolicyAttachment. 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'] === PolicyAttachment.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["policyId"] = state?.policyId; resourceInputs["skipDestroy"] = state?.skipDestroy; resourceInputs["targetId"] = state?.targetId; } else { const args = argsOrState; if (args?.policyId === undefined && !opts.urn) { throw new Error("Missing required property 'policyId'"); } if (args?.targetId === undefined && !opts.urn) { throw new Error("Missing required property 'targetId'"); } resourceInputs["policyId"] = args?.policyId; resourceInputs["skipDestroy"] = args?.skipDestroy; resourceInputs["targetId"] = args?.targetId; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(PolicyAttachment.__pulumiType, name, resourceInputs, opts); } } exports.PolicyAttachment = PolicyAttachment; /** @internal */ PolicyAttachment.__pulumiType = 'aws:organizations/policyAttachment:PolicyAttachment'; //# sourceMappingURL=policyAttachment.js.map