@pulumi/aws
Version:
A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.
141 lines • 5.96 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.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
*
* ### Identity Schema
*
* #### Required
*
* * `id` (String) ID of the AWS Organizations account.
*
* #### Optional
*
* * `account_id` (String) AWS Account where this resource is managed.
*
* Using `pulumi import`, import the AWS member account using the `account_id`. For example:
*
* % pulumi import aws_organizations_account.example 111111111111
*
* To import accounts that have set iam_user_access_to_billing, use the following:
*
* % pulumi import aws_organizations_account.example 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:
*
* terraform
*
* resource "aws_organizations_account" "account" {
*
* name = "my_new_account"
*
* email = "john@doe.org"
*
* role_name = "myOrganizationRole"
*
* # There is no AWS Organizations API for reading role_name
*
* lifecycle {
*
* ignore_changes = [role_name]
*
* }
*
* }
*/
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, { ...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?.arn;
resourceInputs["closeOnDeletion"] = state?.closeOnDeletion;
resourceInputs["createGovcloud"] = state?.createGovcloud;
resourceInputs["email"] = state?.email;
resourceInputs["govcloudId"] = state?.govcloudId;
resourceInputs["iamUserAccessToBilling"] = state?.iamUserAccessToBilling;
resourceInputs["joinedMethod"] = state?.joinedMethod;
resourceInputs["joinedTimestamp"] = state?.joinedTimestamp;
resourceInputs["name"] = state?.name;
resourceInputs["parentId"] = state?.parentId;
resourceInputs["roleName"] = state?.roleName;
resourceInputs["state"] = state?.state;
resourceInputs["status"] = state?.status;
resourceInputs["tags"] = state?.tags;
resourceInputs["tagsAll"] = state?.tagsAll;
}
else {
const args = argsOrState;
if (args?.email === undefined && !opts.urn) {
throw new Error("Missing required property 'email'");
}
resourceInputs["closeOnDeletion"] = args?.closeOnDeletion;
resourceInputs["createGovcloud"] = args?.createGovcloud;
resourceInputs["email"] = args?.email;
resourceInputs["iamUserAccessToBilling"] = args?.iamUserAccessToBilling;
resourceInputs["name"] = args?.name;
resourceInputs["parentId"] = args?.parentId;
resourceInputs["roleName"] = args?.roleName;
resourceInputs["tags"] = args?.tags;
resourceInputs["arn"] = undefined /*out*/;
resourceInputs["govcloudId"] = undefined /*out*/;
resourceInputs["joinedMethod"] = undefined /*out*/;
resourceInputs["joinedTimestamp"] = undefined /*out*/;
resourceInputs["state"] = 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