This component is responsible for provisioning the full account hierarchy along with Organizational Units (OUs). It includes the ability to associate Service Control Policies (SCPs) to the Organization, each Organizational Unit and account.
In addition, it enables AWS IAM Access Analyzer, which helps you identify the resources in your organization and accounts, such as Amazon S3 buckets or IAM roles, that are shared with an external entity. This lets you identify unintended access to your resources and data, which is a security risk. Access Analyzer identifies resources that are shared with external principals by using logic-based reasoning to analyze the resource-based policies in your AWS environment. For each instance of a resource that is shared outside of your account, Access Analyzer generates a finding. Findings include information about the access and the external principal that it is granted to. You can review findings to determine whether the access is intended and safe, or the access is unintended and a security risk.
Stack Level: Global
Here is an example snippet for how to use this component. Stick this snippet in the management account stack (E.g. gbl-root.yaml
)
IMPORTANT: Account names must not contain dashes. Doing so will lead to unpredictable resource names as a -
is the default delimiter. Additionally, account names must be alphanumeric with no special characters.
components:
terraform:
account:
vars:
account_email_format: aws+%[email protected]
account_iam_user_access_to_billing: DENY
organization_enabled: true
aws_service_access_principals:
- cloudtrail.amazonaws.com
- ram.amazonaws.com
enabled_policy_types:
- SERVICE_CONTROL_POLICY
- TAG_POLICY
organization_config:
root_account_stage_name: root
accounts: []
organization:
service_control_policies: []
organizational_units:
- name: data
accounts:
- name: proddata
tags:
eks: true
- name: devdata
tags:
eks: true
- name: stagedata
tags:
eks: true
service_control_policies:
- DenyLeavingOrganization
- name: platform
accounts:
- name: prodplatform
tags:
eks: true
- name: devplatform
tags:
eks: true
- name: stageplatform
tags:
eks: true
service_control_policies:
- DenyLeavingOrganization
- name: mgmt
accounts:
- name: demo
tags:
eks: true
- name: audit
tags:
eks: false
- name: corp
tags:
eks: true
- name: security
tags:
eks: false
- name: identity
tags:
eks: false
- name: network
tags:
eks: false
- name: dns
tags:
eks: false
- name: automation
tags:
eks: true
service_control_policies:
- DenyLeavingOrganization
Name | Version |
---|---|
terraform | >= 1.0.0 |
aws | >= 3.0 |
Name | Version |
---|---|
aws | >= 3.0 |
Name | Source | Version |
---|---|---|
accounts_service_control_policies | cloudposse/service-control-policies/aws | 0.9.2 |
organization_service_control_policies | cloudposse/service-control-policies/aws | 0.9.2 |
organizational_units_service_control_policies | cloudposse/service-control-policies/aws | 0.9.2 |
service_control_policy_statements_yaml_config | cloudposse/config/yaml | 0.8.1 |
this | cloudposse/label/null | 0.25.0 |
Name | Type |
---|---|
aws_organizations_account.organization_accounts | resource |
aws_organizations_account.organizational_units_accounts | resource |
aws_organizations_organization.this | resource |
aws_organizations_organizational_unit.this | resource |
aws_organizations_organization.existing | data source |
Name | Description | Type | Default | Required |
---|---|---|---|---|
account_email_format | Email address format for the accounts (e.g. aws+%[email protected] ) |
string |
n/a | yes |
account_iam_user_access_to_billing | If set to ALLOW , the new account enables IAM users to access account billing information if they have the required permissions. If set to DENY , then only the root user of the new account can access account billing information |
string |
"DENY" |
no |
additional_tag_map | Additional key-value pairs to add to each map in tags_as_list_of_maps . Not added to tags or id .This is for some rare cases where resources want additional configuration of tags and therefore take a list of maps with tag key, value, and additional configuration. |
map(string) |
{} |
no |
attributes | ID element. Additional attributes (e.g. workers or cluster ) to add to id ,in the order they appear in the list. New attributes are appended to the end of the list. The elements of the list are joined by the delimiter and treated as a single ID element. |
list(string) |
[] |
no |
aws_service_access_principals | List of AWS service principal names for which you want to enable integration with your organization. This is typically in the form of a URL, such as service-abbreviation.amazonaws.com. Organization must have feature_set set to ALL. For additional information, see the AWS Organizations User Guide |
list(string) |
n/a | yes |
context | Single object for setting entire context at once. See description of individual variables for details. Leave string and numeric variables as null to use default value.Individual variable settings (non-null) override settings in context object, except for attributes, tags, and additional_tag_map, which are merged. |
any |
{ |
no |
delimiter | Delimiter to be used between ID elements. Defaults to - (hyphen). Set to "" to use no delimiter at all. |
string |
null |
no |
descriptor_formats | Describe additional descriptors to be output in the descriptors output map.Map of maps. Keys are names of descriptors. Values are maps of the form {<br> format = string<br> labels = list(string)<br>} (Type is any so the map values can later be enhanced to provide additional options.)format is a Terraform format string to be passed to the format() function.labels is a list of labels, in order, to pass to format() function.Label values will be normalized before being passed to format() so they will beidentical to how they appear in id .Default is {} (descriptors output will be empty). |
any |
{} |
no |
enabled | Set to false to prevent the module from creating any resources | bool |
null |
no |
enabled_policy_types | List of Organizations policy types to enable in the Organization Root. Organization must have feature_set set to ALL. For additional information about valid policy types (e.g. SERVICE_CONTROL_POLICY and TAG_POLICY), see the AWS Organizations API Reference | list(string) |
n/a | yes |
environment | ID element. Usually used for region e.g. 'uw2', 'us-west-2', OR role 'prod', 'staging', 'dev', 'UAT' | string |
null |
no |
id_length_limit | Limit id to this many characters (minimum 6).Set to 0 for unlimited length.Set to null for keep the existing setting, which defaults to 0 .Does not affect id_full . |
number |
null |
no |
label_key_case | Controls the letter case of the tags keys (label names) for tags generated by this module.Does not affect keys of tags passed in via the tags input.Possible values: lower , title , upper .Default value: title . |
string |
null |
no |
label_order | The order in which the labels (ID elements) appear in the id .Defaults to ["namespace", "environment", "stage", "name", "attributes"]. You can omit any of the 6 labels ("tenant" is the 6th), but at least one must be present. |
list(string) |
null |
no |
label_value_case | Controls the letter case of ID elements (labels) as included in id ,set as tag values, and output by this module individually. Does not affect values of tags passed in via the tags input.Possible values: lower , title , upper and none (no transformation).Set this to title and set delimiter to "" to yield Pascal Case IDs.Default value: lower . |
string |
null |
no |
labels_as_tags | Set of labels (ID elements) to include as tags in the tags output.Default is to include all labels. Tags with empty values will not be included in the tags output.Set to [] to suppress all generated tags.Notes: The value of the name tag, if included, will be the id , not the name .Unlike other null-label inputs, the initial setting of labels_as_tags cannot bechanged in later chained modules. Attempts to change it will be silently ignored. |
set(string) |
[ |
no |
name | ID element. Usually the component or solution name, e.g. 'app' or 'jenkins'. This is the only ID element not also included as a tag .The "name" tag is set to the full id string. There is no tag with the value of the name input. |
string |
null |
no |
namespace | ID element. Usually an abbreviation of your organization name, e.g. 'eg' or 'cp', to help ensure generated IDs are globally unique | string |
null |
no |
organization_config | Organization, Organizational Units and Accounts configuration | any |
n/a | yes |
organization_enabled | A boolean flag indicating whether to create an Organization or use the existing one | bool |
true |
no |
regex_replace_chars | Terraform regular expression (regex) string. Characters matching the regex will be removed from the ID elements. If not set, "/[^a-zA-Z0-9-]/" is used to remove all characters other than hyphens, letters and digits. |
string |
null |
no |
region | AWS Region | string |
n/a | yes |
service_control_policies_config_paths | List of paths to Service Control Policy configurations | list(string) |
n/a | yes |
stage | ID element. Usually used to indicate role, e.g. 'prod', 'staging', 'source', 'build', 'test', 'deploy', 'release' | string |
null |
no |
tags | Additional tags (e.g. {'BusinessUnit': 'XYZ'} ).Neither the tag keys nor the tag values will be modified by this module. |
map(string) |
{} |
no |
tenant | ID element _(Rarely used, not included by default)_. A customer identifier, indicating who this instance of a resource is for | string |
null |
no |
tfstate_account_id | The ID of the account where the Terraform remote state backend is provisioned | string |
"" |
no |
tfstate_assume_role | Set to false to use the caller's role to access the Terraform remote state | bool |
true |
no |
tfstate_bucket_environment_name | The name of the environment for Terraform state bucket | string |
"" |
no |
tfstate_bucket_stage_name | The name of the stage for Terraform state bucket | string |
"root" |
no |
tfstate_existing_role_arn | The ARN of the existing IAM Role to access the Terraform remote state. If not provided and remote_state_assume_role is true , a role will be constructed from remote_state_role_arn_template |
string |
"" |
no |
tfstate_role_arn_template | IAM Role ARN template for accessing the Terraform remote state | string |
"arn:aws:iam::%s:role/%s-%s-%s-%s" |
no |
tfstate_role_environment_name | The name of the environment for Terraform state IAM role | string |
"gbl" |
no |
tfstate_role_name | IAM Role name for accessing the Terraform remote state | string |
"terraform" |
no |
tfstate_role_stage_name | The name of the stage for Terraform state IAM role | string |
"root" |
no |
Name | Description |
---|---|
account_arns | List of account ARNs (excluding root account) |
account_ids | List of account IDs (excluding root account) |
account_info_map | Map of account names to eks: boolean, account hosts at least one EKS cluster id: account id (number) stage: (optional) the account "stage" tenant: (optional) the account "tenant" |
account_names_account_arns | Map of account names to account ARNs (excluding root account) |
account_names_account_ids | Map of account names to account IDs (excluding root account) |
account_names_account_scp_arns | Map of account names to SCP ARNs for accounts with SCPs |
account_names_account_scp_ids | Map of account names to SCP IDs for accounts with SCPs |
eks_accounts | List of EKS accounts |
non_eks_accounts | List of non EKS accounts |
organization_arn | Organization ARN |
organization_id | Organization ID |
organization_master_account_arn | Organization master account ARN |
organization_master_account_email | Organization master account email |
organization_master_account_id | Organization master account ID |
organization_scp_arn | Organization Service Control Policy ARN |
organization_scp_id | Organization Service Control Policy ID |
organizational_unit_arns | List of Organizational Unit ARNs |
organizational_unit_ids | List of Organizational Unit IDs |
organizational_unit_names_organizational_unit_arns | Map of Organizational Unit names to Organizational Unit ARNs |
organizational_unit_names_organizational_unit_ids | Map of Organizational Unit names to Organizational Unit IDs |
organizational_unit_names_organizational_unit_scp_arns | Map of OU names to SCP ARNs |
organizational_unit_names_organizational_unit_scp_ids | Map of OU names to SCP IDs |
- cloudposse/terraform-aws-components - Cloud Posse's upstream component