UNPKG

@pulumi/aws

Version:

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

111 lines 5.82 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.Account = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("../utilities"); /** * Provides a resource to create a member account in the current organization. * * > **Note:** Account management must be done from the organization's root account. * * > **Note:** By default, deleting this resource will only remove an AWS account from an organization. You must set the `closeOnDeletion` flag to true to close the account. It is worth noting that quotas are enforced when using the `closeOnDeletion` argument, which can produce a [CLOSE_ACCOUNT_QUOTA_EXCEEDED](https://docs.aws.amazon.com/organizations/latest/APIReference/API_CloseAccount.html) error, and require you to close the account manually. * * ## Example Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const account = new aws.organizations.Account("account", { * name: "my_new_account", * email: "john@doe.org", * }); * ``` * * ## Import * * Using `pulumi import`, import the AWS member account using the `account_id`. For example: * * ```sh * $ pulumi import aws:organizations/account:Account my_account 111111111111 * ``` * To import accounts that have set iam_user_access_to_billing, use the following: * * ```sh * $ pulumi import aws:organizations/account:Account my_account 111111111111_ALLOW * ``` * Certain resource arguments, like `role_name`, do not have an Organizations API method for reading the information after account creation. If the argument is set in the Pulumi program on an imported resource, Pulumi will always show a difference. To workaround this behavior, either omit the argument from the Pulumi program or use `ignore_changes` to hide the difference. For example: */ class Account extends pulumi.CustomResource { /** * Get an existing Account 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 Account(name, state, Object.assign(Object.assign({}, opts), { id: id })); } /** * Returns true if the given object is an instance of Account. 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'] === Account.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["arn"] = state ? state.arn : undefined; resourceInputs["closeOnDeletion"] = state ? state.closeOnDeletion : undefined; resourceInputs["createGovcloud"] = state ? state.createGovcloud : undefined; resourceInputs["email"] = state ? state.email : undefined; resourceInputs["govcloudId"] = state ? state.govcloudId : undefined; resourceInputs["iamUserAccessToBilling"] = state ? state.iamUserAccessToBilling : undefined; resourceInputs["joinedMethod"] = state ? state.joinedMethod : undefined; resourceInputs["joinedTimestamp"] = state ? state.joinedTimestamp : undefined; resourceInputs["name"] = state ? state.name : undefined; resourceInputs["parentId"] = state ? state.parentId : undefined; resourceInputs["roleName"] = state ? state.roleName : undefined; resourceInputs["status"] = state ? state.status : undefined; resourceInputs["tags"] = state ? state.tags : undefined; resourceInputs["tagsAll"] = state ? state.tagsAll : undefined; } else { const args = argsOrState; if ((!args || args.email === undefined) && !opts.urn) { throw new Error("Missing required property 'email'"); } resourceInputs["closeOnDeletion"] = args ? args.closeOnDeletion : undefined; resourceInputs["createGovcloud"] = args ? args.createGovcloud : undefined; resourceInputs["email"] = args ? args.email : undefined; resourceInputs["iamUserAccessToBilling"] = args ? args.iamUserAccessToBilling : undefined; resourceInputs["name"] = args ? args.name : undefined; resourceInputs["parentId"] = args ? args.parentId : undefined; resourceInputs["roleName"] = args ? args.roleName : undefined; resourceInputs["tags"] = args ? args.tags : undefined; resourceInputs["arn"] = undefined /*out*/; resourceInputs["govcloudId"] = undefined /*out*/; resourceInputs["joinedMethod"] = undefined /*out*/; resourceInputs["joinedTimestamp"] = undefined /*out*/; resourceInputs["status"] = undefined /*out*/; resourceInputs["tagsAll"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(Account.__pulumiType, name, resourceInputs, opts); } } exports.Account = Account; /** @internal */ Account.__pulumiType = 'aws:organizations/account:Account'; //# sourceMappingURL=account.js.map