AWS IAM Organizational Unit

This page shows how to write Terraform for IAM Organizational Unit and write them securely.

aws_organizations_organizational_unit (Terraform)

The Organizational Unit in IAM can be configured in Terraform with the resource name aws_organizations_organizational_unit. The following sections describe 5 examples of how to use the resource and its parameters.

Example Usage from GitHub

organizations.tf#L7
resource "aws_organizations_organizational_unit" "develop_a" {
  name      = "Aサービス事業部"
  parent_id = data.aws_organizations_organization.my_org.roots[0].id
}

resource "aws_organizations_organizational_unit" "develop_a1group" {
orgunits.tf#L4
resource "aws_organizations_organizational_unit" "core" {
  name      = "core"
  parent_id = data.aws_organizations_organization.my_org.roots[0].id
}

resource "aws_organizations_organizational_unit" "teams" {
organizations.tf#L109
resource "aws_organizations_organizational_unit" "Inovacao" {
  name      = "Inovacao"
  parent_id = aws_organizations_organization.Root.roots[0].id

}

orginzation_units.tf#L2
resource "aws_organizations_organizational_unit" "application" {
    # OU Must be created before childen n the ou can be created
    depends_on = [aws_organizations_organization.org]
    name =  "application"
    parent_id = aws_organizations_organization.org.roots[0].id
}
organisation.tf#L15
resource "aws_organizations_organizational_unit" "core" {
  name      = "Core"
  parent_id = aws_organizations_organization.default.roots.0.id
}

resource "aws_organizations_organizational_unit" "development" {

Review your Terraform file for AWS best practices

Shisho Cloud, our free checker to make sure your Terraform configuration follows best practices, is available (beta).

Parameters

Explanation in Terraform Registry

Provides a resource to create an organizational unit.

Tips: Best Practices for The Other AWS IAM Resources

In addition to the aws_iam_account_password_policy, AWS IAM has the other resources that should be configured for security reasons. Please check some examples of those resources and precautions.

risk-label

aws_iam_account_password_policy

Ensure AWS IAM account password policies requires long passwords

It's better to enforce the use of long and complex passwords to reduce the risk of bruteforce attacks.

Review your AWS IAM settings

In addition to the above, there are other security points you should be aware of making sure that your .tf files are protected in Shisho Cloud.

CloudFormation Example

CloudFormation code does not have the related resource.

Frequently asked questions

What is AWS IAM Organizational Unit?

AWS IAM Organizational Unit is a resource for IAM of Amazon Web Service. Settings can be wrote in Terraform.

Where can I find the example code for the AWS IAM Organizational Unit?

For Terraform, the hapoon/aws-infra, chris2fer/aws-org-test and gustavopelizoni/aws-terraform-organizations source code examples are useful. See the Terraform Example section for further details.