Skip to content

RaftechNL/terraform-aws-organization

Β 
Β 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

41 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

AWS Organizations Terraform module

A Terraform module which configures your AWS Organization and creates AWS accounts. Read this page for more information, and for a secure reference architecture by AWS, read this page.

blackbird-logo

Example

module "organization" {
  source  = "../modules/organization"
  version = "~> 3"

  aws_service_access_principals = [
    "access-analyzer.amazonaws.com",
    "account.amazonaws.com",
    "cloudtrail.amazonaws.com",
    "member.org.stacksets.cloudformation.amazonaws.com",
    "sso.amazonaws.com"
  ]
  enabled_policy_types = ["BACKUP_POLICY", "SERVICE_CONTROL_POLICY", "TAG_POLICY"]
  feature_set          = "ALL"

  primary_contact = {
    address_line_1  = "123 Main St"
    city            = "Anytown"
    country_code    = "US"
    full_name       = "John Doe"
    phone_number    = "+1-555-555-5555"
    postal_code     = "12345"
    state_or_region = "WA"
  }

  billing_contact = {
    name          = "Jane Doe"
    title         = "Billing"
    email_address = "[email protected]"
  }

  operations_contact = {
    name          = "Jane Doe"
    title         = "Operations"
    email_address = "[email protected]"
  }

  security_contact = {
    name          = "Jane Doe"
    title         = "Security"
    email_address = "[email protected]"
  }
}

module "organization_units" {
  source  = "../modules/organization-units"
  version = "~> 3"

  organizations_units = {
    "Development" = {
      parent_id = module.organization.organization_root_id
    }
    "Operations" = {
      parent_id = module.organization.organization_root_id
    }
    "Security" = {
      parent_id = module.organization.organization_root_id
    }
  }
}

module "accounts" {
  source  = "../modules/accounts"
  version = "~> 3"

  contacts = dependency.org.outputs.contacts
  accounts = {
    keys = {
      email                            = "[email protected]"
      delegated_administrator_services = []
      parent_id                        = dependency.ous.outputs.ous["security"].id
    }
    logs = {
      email                            = "[email protected]"
      delegated_administrator_services = []
      parent_id                        = dependency.ous.outputs.ous["security"].id
    }
  }
}

module "org_policies" {
  source  = "../modules/org-policies"
  version = "~> 3"

  organizations_policies = {
    "BackupPolicy" = {
      description = "Backup policy"
      policy      = file("${path.module}/policies/backup_policy.json")
      target_id   = module.organization.organization_root_id
      type        = "BACKUP_POLICY"
    }
    "ServiceControlPolicy" = {
      description = "Service control policy"
      policy      = file("${path.module}/policies/service_control_policy.json")
      target_id   = module.organization.organization_root_id
      type        = "SERVICE_CONTROL_POLICY"
    }
    "TagPolicy" = {
      description = "Tag policy"
      policy      = file("${path.module}/policies/tag_policy.json")
      target_id   = module.organization.organization_root_id
      type        = "TAG_POLICY"
    }
  }
}

AWS Organizations Terraform module

A Terraform module which configures your AWS Organization and creates AWS accounts. Read this page for more information, and for a secure reference architecture by AWS, read this page.

blackbird-logo

Requirements

Name Version
terraform >= 1
aws ~> 5

Providers

Name Version
aws 5.49.0

Resources

Name Type
aws_account_alternate_contact.billing resource
aws_account_alternate_contact.operations resource
aws_account_alternate_contact.security resource
aws_account_primary_contact.default resource
aws_organizations_account.default resource
aws_organizations_delegated_administrator.default resource

Inputs

Name Description Type Default Required
accounts List of AWS accounts to create
map(object({
email = string
close_on_deletion = optional(bool)
iam_user_access_to_billing = optional(bool)
delegated_administrator_services = list(string)
tags = optional(map(string))
parent_id = optional(string)
}))
n/a yes
contacts Primary and alternate contacts for the accounts
object({
primary_contact = object({
address_line_1 = string
address_line_2 = optional(string)
address_line_3 = optional(string)
city = string
company_name = optional(string)
country_code = string
district_or_county = optional(string)
full_name = string
phone_number = string
postal_code = string
state_or_region = optional(string)
website_url = optional(string)
})
operations_contact = object({
name = string
title = string
email_address = string
phone_number = optional(string)
})
billing_contact = object({
name = string
title = string
email_address = string
phone_number = optional(string)
})
security_contact = object({
name = string
title = string
email_address = string
phone_number = optional(string)
})
})
n/a yes

Outputs

Name Description
accounts The accounts created

About

We are Blackbird Cloud, Amsterdam based cloud consultancy, and cloud management service provider. We help companies build secure, cost efficient, and scale-able solutions.

Checkout our other πŸ‘‰ terraform modules

Copyright

Copyright Β© 2017-2023 Blackbird Cloud

AWS Organizations Terraform module

A Terraform module which configures your AWS Organization and creates AWS accounts. Read this page for more information, and for a secure reference architecture by AWS, read this page.

blackbird-logo

Requirements

Name Version
terraform >= 1
aws ~> 5

Providers

Name Version
aws 5.49.0

Resources

Name Type
aws_account_alternate_contact.root_billing resource
aws_account_alternate_contact.root_operations resource
aws_account_alternate_contact.root_security resource
aws_account_primary_contact.root resource
aws_organizations_organization.default resource

Inputs

Name Description Type Default Required
aws_service_access_principals (Optional) 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. Some services do not support enablement via this endpoint, see warning in aws docs. https://docs.aws.amazon.com/organizations/latest/userguide/orgs_integrate_services_list.html list(string) n/a yes
billing_contact email_address - (Required) An email address for the alternate contact. name - (Required) Name of the alternate contact. phone_number - (Required) Phone number for the alternate contact. title - (Required) Title for the alternate contact. any n/a yes
enabled_policy_types (Optional) 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., AISERVICES_OPT_OUT_POLICY, BACKUP_POLICY, SERVICE_CONTROL_POLICY, and TAG_POLICY), see the AWS Organizations API Reference. list(string) [] no
feature_set (Optional) Specify "ALL" (default) or "CONSOLIDATED_BILLING". string n/a yes
operations_contact email_address - (Required) An email address for the alternate contact. name - (Required) Name of the alternate contact. phone_number - (Required) Phone number for the alternate contact. title - (Required) Title for the alternate contact. any n/a yes
primary_contact address_line_1 - (Required) The first line of the primary contact address. address_line_2 - (Optional) The second line of the primary contact address, if any. address_line_3 - (Optional) The third line of the primary contact address, if any. city - (Required) The city of the primary contact address. company_name - (Optional) The name of the company associated with the primary contact information, if any. country_code - (Required) The ISO-3166 two-letter country code for the primary contact address. district_or_county - (Optional) The district or county of the primary contact address, if any. full_name - (Required) The full name of the primary contact address. phone_number - (Required) The phone number of the primary contact information. The number will be validated and, in some countries, checked for activation. postal_code - (Required) The postal code of the primary contact address. state_or_region - (Optional) The state or region of the primary contact address. This field is required in selected countries. website_url - (Optional) The URL of the website associated with the primary contact information, if any. any n/a yes
security_contact email_address - (Required) An email address for the alternate contact. name - (Required) Name of the alternate contact. phone_number - (Required) Phone number for the alternate contact. title - (Required) Title for the alternate contact. any n/a yes

Outputs

Name Description
contacts The contacts for the organization
organization_root_id The ID of the organization root

About

We are Blackbird Cloud, Amsterdam based cloud consultancy, and cloud management service provider. We help companies build secure, cost efficient, and scale-able solutions.

Checkout our other πŸ‘‰ terraform modules

Copyright

Copyright Β© 2017-2023 Blackbird Cloud

AWS Organizations Terraform module

A Terraform module which configures your AWS Organization and creates AWS accounts. Read this page for more information, and for a secure reference architecture by AWS, read this page.

blackbird-logo

Requirements

Name Version
terraform >= 1
aws ~> 5

Providers

Name Version
aws 5.49.0

Resources

Name Type
aws_organizations_policy.default resource
aws_organizations_policy_attachment.default resource

Inputs

Name Description Type Default Required
organizations_policies A map of policies to attach to the organization
map(object({
content = string
ous = list(string)
description = optional(string)
skip_destroy = optional(bool)
type = optional(string)
}))
n/a yes
tags A map of tags to add to the resources map(string) n/a yes

Outputs

Name Description
policies The policies for the organization

About

We are Blackbird Cloud, Amsterdam based cloud consultancy, and cloud management service provider. We help companies build secure, cost efficient, and scale-able solutions.

Checkout our other πŸ‘‰ terraform modules

Copyright

Copyright Β© 2017-2023 Blackbird Cloud

AWS Organizations Terraform module

A Terraform module which configures your AWS Organization and creates AWS accounts. Read this page for more information, and for a secure reference architecture by AWS, read this page.

blackbird-logo

Requirements

Name Version
terraform >= 1
aws ~> 5

Providers

Name Version
aws 5.49.0

Resources

Name Type
aws_organizations_organizational_unit.default resource

Inputs

Name Description Type Default Required
organization_units List of organizational units to create
map(object(
{
name = string
parent_id = string
tags = optional(map(string))
}
))
n/a yes

Outputs

Name Description
ous The organizational units for the organization

About

We are Blackbird Cloud, Amsterdam based cloud consultancy, and cloud management service provider. We help companies build secure, cost efficient, and scale-able solutions.

Checkout our other πŸ‘‰ terraform modules

Copyright

Copyright Β© 2017-2023 Blackbird Cloud

About

We are Blackbird Cloud, Amsterdam based cloud consultancy, and cloud management service provider. We help companies build secure, cost efficient, and scale-able solutions.

Checkout our other πŸ‘‰ terraform modules

Copyright

Copyright Β© 2017-2023 Blackbird Cloud