This Terraform module creates IAM policies, and associated policy documents, allowing groups/users in a 'master' AWS account to assume roles in other accounts.
The "account type" concept allows for more granular control of permissions for IAM groups across multiple categories -- or "types" -- of AWS accounts. As an example:
An organization has the following accounts:
- Dev / Infrastructure
- Dev / S3 Buckets
- Prod / Infrastructure
- Prod / S3 Buckets
- Master
Each account has the same list of roles, e.g.: FullAdmin, PowerUser, ReadOnly, SOCAdmin.
- 3 AWS accounts for development
- 2 accounts for production
- 1 account for 'master'
A module can be added to the Terraform configuration for each "type" of account, which will create all necessary IAM policies (and documents) to allow AssumeRole access for each Role to all accounts within that "type".
module "assume_roles_prod" {
source = "github.com/18F/identity-terraform//iam_masterassume?ref=main"
role_list = [
"FullAdministrator",
"PowerUser",
"ReadOnly",
"BillingReadOnly",
"ReportsReadOnly",
"KMSAdministrator",
"SOCAdministrator",
]
account_type = "Prod"
account_numbers = [
"111111111111",
"222222222222"
]
}
account_type: The "type", aka "category", of AWS account(s) that this module will create policies for.account_numbers: A list of AWS account number(s) within theaccount_typecategory.role_list: A list of the roles available to be assumed from within the account(s).
policy_arns: A list of the ARNs of the newly-created policies. Reference this output in order to depend on policy creation being complete.