Class Account


  • public class Account
    extends com.pulumi.resources.CustomResource
    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
     
     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());
     
         }
     }
     
     
    ## 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: ```sh $ pulumi import aws:organizations/account:Account example 111111111111 ``` To import accounts that have set iam_user_access_to_billing, use the following: ```sh $ 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:
     
     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());
     
         }
     }
     
     
    • Nested Class Summary

      • Nested classes/interfaces inherited from class com.pulumi.resources.CustomResource

        com.pulumi.resources.CustomResource.CustomResourceInternal
      • Nested classes/interfaces inherited from class com.pulumi.resources.Resource

        com.pulumi.resources.Resource.LazyField<T extends java.lang.Object>, com.pulumi.resources.Resource.LazyFields, com.pulumi.resources.Resource.ResourceInternal
    • Field Summary

      • Fields inherited from class com.pulumi.resources.Resource

        childResources, remote
    • Constructor Summary

      Constructors 
      Constructor Description
      Account​(java.lang.String name)  
      Account​(java.lang.String name, AccountArgs args)  
      Account​(java.lang.String name, AccountArgs args, com.pulumi.resources.CustomResourceOptions options)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      com.pulumi.core.Output<java.lang.String> arn()  
      com.pulumi.core.Output<java.util.Optional<java.lang.Boolean>> closeOnDeletion()  
      com.pulumi.core.Output<java.util.Optional<java.lang.Boolean>> createGovcloud()  
      com.pulumi.core.Output<java.lang.String> email()  
      static Account get​(java.lang.String name, com.pulumi.core.Output<java.lang.String> id, AccountState state, com.pulumi.resources.CustomResourceOptions options)
      Get an existing Host resource's state with the given name, ID, and optional extra properties used to qualify the lookup.
      com.pulumi.core.Output<java.lang.String> govcloudId()  
      com.pulumi.core.Output<java.util.Optional<java.lang.String>> iamUserAccessToBilling()  
      com.pulumi.core.Output<java.lang.String> joinedMethod()  
      com.pulumi.core.Output<java.lang.String> joinedTimestamp()  
      com.pulumi.core.Output<java.lang.String> name()  
      com.pulumi.core.Output<java.lang.String> parentId()  
      com.pulumi.core.Output<java.util.Optional<java.lang.String>> roleName()  
      com.pulumi.core.Output<java.lang.String> state()  
      com.pulumi.core.Output<java.lang.String> status()  
      com.pulumi.core.Output<java.util.Optional<java.util.Map<java.lang.String,​java.lang.String>>> tags()  
      com.pulumi.core.Output<java.util.Map<java.lang.String,​java.lang.String>> tagsAll()  
      • Methods inherited from class com.pulumi.resources.CustomResource

        getId, id, idFuture
      • Methods inherited from class com.pulumi.resources.Resource

        getChildResources, getResourceName, getResourceType, getUrn, pulumiChildResources, pulumiResourceName, pulumiResourceType, urn
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Account

        public Account​(java.lang.String name)
        Parameters:
        name - The _unique_ name of the resulting resource.
      • Account

        public Account​(java.lang.String name,
                       AccountArgs args)
        Parameters:
        name - The _unique_ name of the resulting resource.
        args - The arguments to use to populate this resource's properties.
      • Account

        public Account​(java.lang.String name,
                       AccountArgs args,
                       @Nullable
                       com.pulumi.resources.CustomResourceOptions options)
        Parameters:
        name - The _unique_ name of the resulting resource.
        args - The arguments to use to populate this resource's properties.
        options - A bag of options that control this resource's behavior.
    • Method Detail

      • arn

        public com.pulumi.core.Output<java.lang.String> arn()
        Returns:
        ARN for this account.
      • closeOnDeletion

        public com.pulumi.core.Output<java.util.Optional<java.lang.Boolean>> closeOnDeletion()
        Returns:
        If true, a deletion event will close the account. Otherwise, it will only remove from the organization. This is not supported for GovCloud accounts.
      • createGovcloud

        public com.pulumi.core.Output<java.util.Optional<java.lang.Boolean>> createGovcloud()
        Returns:
        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 the `govcloudId` attribute. The only way to manage the GovCloud account with the provider is to subsequently import the account using this resource.
      • email

        public com.pulumi.core.Output<java.lang.String> email()
        Returns:
        Email address of the owner to assign to the new member account. This email address must not already be associated with another AWS account.
      • govcloudId

        public com.pulumi.core.Output<java.lang.String> govcloudId()
        Returns:
        ID for a GovCloud account created with the account.
      • iamUserAccessToBilling

        public com.pulumi.core.Output<java.util.Optional<java.lang.String>> iamUserAccessToBilling()
        Returns:
        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 to `DENY`, 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 to `ALLOW`. If the resource is created and this option is changed, it will try to recreate the account.
      • joinedMethod

        public com.pulumi.core.Output<java.lang.String> joinedMethod()
        Returns:
        Method by which the account joined the organization.
      • joinedTimestamp

        public com.pulumi.core.Output<java.lang.String> joinedTimestamp()
        Returns:
        Date the account became a part of the organization.
      • name

        public com.pulumi.core.Output<java.lang.String> name()
        Returns:
        Friendly name for the member account. The following arguments are optional:
      • parentId

        public com.pulumi.core.Output<java.lang.String> parentId()
        Returns:
        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.
      • roleName

        public com.pulumi.core.Output<java.util.Optional<java.lang.String>> roleName()
        Returns:
        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 `ignoreChanges` is used.
      • state

        public com.pulumi.core.Output<java.lang.String> state()
        Returns:
        State of the account in the organization.
      • status

        public com.pulumi.core.Output<java.lang.String> status()
        Returns:
        (**Deprecated** use `state` instead) Status of the account in the organization.
      • tags

        public com.pulumi.core.Output<java.util.Optional<java.util.Map<java.lang.String,​java.lang.String>>> tags()
        Returns:
        Key-value map of resource tags. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
      • tagsAll

        public com.pulumi.core.Output<java.util.Map<java.lang.String,​java.lang.String>> tagsAll()
        Returns:
        A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
      • get

        public static Account get​(java.lang.String name,
                                  com.pulumi.core.Output<java.lang.String> id,
                                  @Nullable
                                  AccountState state,
                                  @Nullable
                                  com.pulumi.resources.CustomResourceOptions options)
        Get an existing Host resource's state with the given name, ID, and optional extra properties used to qualify the lookup.
        Parameters:
        name - The _unique_ name of the resulting resource.
        id - The _unique_ provider ID of the resource to lookup.
        state -
        options - Optional settings to control the behavior of the CustomResource.