Resource: aws_organizations_account

Provides a resource to create a member account in the current organization.

Example Usage

resource "aws_organizations_account" "account" {
  name  = "my_new_account"
  email = "john@doe.org"
}

Argument Reference

The following arguments are required:

The following arguments are optional:

Attribute Reference

This resource exports the following attributes in addition to the arguments above:

Import

In Terraform v1.5.0 and later, use an import block to import the AWS member account using the account_id. For example:

import {
  to = aws_organizations_account.my_account
  id = "111111111111"
}

Using terraform import, import the AWS member account using the account_id. For example:

% terraform import aws_organizations_account.my_account 111111111111

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 Terraform configuration on an imported resource, Terraform will always show a difference. To workaround this behavior, either omit the argument from the Terraform configuration or use ignore_changes to hide the difference. For example:

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]
  }
}