Account class
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 error, and require you to close the account manually.
Example Usage
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 pulumi
import pulumi_aws as aws
account = aws.organizations.Account("account",
name="my_new_account",
email="john@doe.org")
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var account = new Aws.Organizations.Account("account", new()
{
Name = "my_new_account",
Email = "john@doe.org",
});
});
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/organizations"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := organizations.NewAccount(ctx, "account", &organizations.AccountArgs{
Name: pulumi.String("my_new_account"),
Email: pulumi.String("john@doe.org"),
})
if err != nil {
return err
}
return nil
})
}
pulumi {
required_providers {
aws = {
source = "pulumi/aws"
}
}
}
resource "aws_organizations_account" "account" {
name = "my_new_account"
email = "john@doe.org"
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.organizations.Account;
import com.pulumi.aws.organizations.AccountArgs;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var account = new Account("account", AccountArgs.builder()
.name("my_new_account")
.email("john@doe.org")
.build());
}
}
resources:
account:
type: aws:organizations:Account
properties:
name: my_new_account
email: john@doe.org
Import
Identity Schema
Required
id(String) ID of the AWS Organizations account.
Optional
accountId(String) AWS Account where this resource is managed.
Using pulumi import, import the AWS member account using the accountId. For example:
$ pulumi import aws:organizations/account:Account example 111111111111
To import accounts that have set iam_user_access_to_billing, use the following:
$ pulumi import aws:organizations/account:Account example 111111111111_ALLOW
Certain resource arguments, like roleName, 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 ignoreChanges to hide the difference. For example:
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",
roleName: "myOrganizationRole",
}, {
ignoreChanges: ["roleName"],
});
import pulumi
import pulumi_aws as aws
account = aws.organizations.Account("account",
name="my_new_account",
email="john@doe.org",
role_name="myOrganizationRole",
opts = pulumi.ResourceOptions(ignore_changes=["roleName"]))
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var account = new Aws.Organizations.Account("account", new()
{
Name = "my_new_account",
Email = "john@doe.org",
RoleName = "myOrganizationRole",
}, new CustomResourceOptions
{
IgnoreChanges =
{
"roleName",
},
});
});
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/organizations"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := organizations.NewAccount(ctx, "account", &organizations.AccountArgs{
Name: pulumi.String("my_new_account"),
Email: pulumi.String("john@doe.org"),
RoleName: pulumi.String("myOrganizationRole"),
}, pulumi.IgnoreChanges([]string{
"roleName",
}))
if err != nil {
return err
}
return nil
})
}
pulumi {
required_providers {
aws = {
source = "pulumi/aws"
}
}
}
resource "aws_organizations_account" "account" {
lifecycle {
ignore_changes = [roleName]
}
name = "my_new_account"
email = "john@doe.org"
role_name = "myOrganizationRole"
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.organizations.Account;
import com.pulumi.aws.organizations.AccountArgs;
import com.pulumi.resources.CustomResourceOptions;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var account = new Account("account", AccountArgs.builder()
.name("my_new_account")
.email("john@doe.org")
.roleName("myOrganizationRole")
.build(), CustomResourceOptions.builder()
.ignoreChanges("roleName")
.build());
}
}
resources:
account:
type: aws:organizations:Account
properties:
name: my_new_account
email: john@doe.org
roleName: myOrganizationRole
options:
ignoreChanges:
- roleName
Constructors
- Account(String name, {AccountArgs? args, CustomResourceOptions? options})
-
Creates a new Account.
nameThe Pulumi resource name.argsArguments used to configure this Account. The set of arguments for Account.optionsResource options controlling this resource's behavior. - Account.reference(String urn)
- Creates a typed reference to an existing Account resource.
Properties
-
arn
↔ Output<
String> -
ARN for this account.
latefinal
-
childResources
→ Set<
Resource> -
finalinherited
-
closeOnDeletion
↔ Output<
bool?> -
If true, a deletion event will close the account. Otherwise, it will only remove from the organization. This is not supported for GovCloud accounts.
latefinal
-
completionSources
↔ Map<
String, IOutputCompletionSource> -
latefinalinherited
-
createGovcloud
↔ Output<
bool?> -
Whether to also create a GovCloud account. The GovCloud account is tied to the main (commercial) account this resource creates. If
true, the GovCloud account ID is available in thegovcloudIdattribute. The only way to manage the GovCloud account with the provider is to subsequently import the account using this resource.latefinal -
email
↔ Output<
String> -
Email address of the owner to assign to the new member account. This email address must not already be associated with another AWS account.
latefinal
-
govcloudId
↔ Output<
String> -
ID for a GovCloud account created with the account.
latefinal
- hashCode → int
-
The hash code for this object.
no setterinherited
-
iamUserAccessToBilling
↔ Output<
String?> -
If set to
ALLOW, the new account enables IAM users and roles to access account billing information if they have the required permissions. If set toDENY, then only the root user (and no roles) of the new account can access account billing information. If this is unset, the AWS API will default this toALLOW. If the resource is created and this option is changed, it will try to recreate the account.latefinal -
id
↔ Output<
String> -
getter/setter pairinherited
- isCustom → bool
-
Returns whether this resource is provider-managed.
no setterinherited
- isProtected → bool
-
Returns whether this resource is protected from deletion.
no setterinherited
- isRemote → bool
-
Whether this resource is registered as remote.
no setterinherited
- isResourceReference → bool
-
Whether this instance represents a resource value returned over RPC.
finalinherited
-
joinedMethod
↔ Output<
String> -
Method by which the account joined the organization.
latefinal
-
joinedTimestamp
↔ Output<
String> -
Date the account became a part of the organization.
latefinal
-
name
↔ Output<
String> -
Friendly name for the member account.
latefinal
-
parentId
↔ Output<
String> -
Parent Organizational Unit ID or Root ID for the account. Defaults to the Organization default Root ID. A configuration must be present for this argument to perform drift detection.
latefinal
-
resourceTransforms
→ List<
ResourceTransform> -
Inherited/explicit async transforms.
no setterinherited
-
roleName
↔ Output<
String?> -
The name of an IAM role that Organizations automatically preconfigures in the new member account. This role trusts the root account, allowing users in the root account to assume the role, as permitted by the root account administrator. The role has administrator permissions in the new member account. The Organizations API provides no method for reading this information after account creation, so the provider cannot perform drift detection on its value and will always show a difference for a configured value after import unless
ignoreChangesis used.latefinal - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
state
↔ Output<
String> -
State of the account in the organization.
latefinal
-
status
↔ Output<
String> -
(Deprecated use
stateinstead) Status of the account in the organization.latefinal -
Key-value map of resource tags. If configured with a provider
defaultTagsconfiguration block present, tags with matching keys will overwrite those defined at the provider-level.latefinal -
A map of tags assigned to the resource, including those inherited from the provider
defaultTagsconfiguration block.latefinal -
transformations
→ List<
ResourceTransformation> -
Inherited/explicit legacy transformations.
no setterinherited
-
urn
↔ Output<
String> -
latefinalinherited
Methods
-
failId(
Object error) → void -
Completes this resource ID with an error when registration fails.
inherited
-
failOutputs(
Object error) → void -
Completes all output properties with
error.inherited -
failUrn(
Object error) → void -
Completes this resource URN with an error when registration fails.
inherited
-
getProvider(
String moduleMember) → ProviderResource? -
Returns provider for
moduleMember's package, if configured.inherited -
getResourceName(
) → String -
Returns this resource's logical name.
inherited
-
getResourceType(
) → String -
Returns this resource's Pulumi type token.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
registerOutput<
T> (String propertyName, {Object? decoder(Object?)?, bool isSecret = false}) → Output< T> -
Registers a dynamic output property for this resource.
inherited
-
resolveId(
String? value, {required bool isKnown}) → void -
Resolves the provider-assigned ID for this resource.
inherited
-
resolveOutputs(
Struct outputs) → void -
Resolves all output properties from a monitor response payload.
inherited
-
resolveUrn(
String value) → void -
Resolves this resource's URN once assigned by the engine.
inherited
-
serializeProperties(
Map< String, dynamic> properties) → Future<Struct> -
Serializes resource properties for RPC transmission.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited