Skip to main content

Module: iam-assumed-roles

Terraform module to provision two IAM roles and two IAM groups for assuming the roles provided MFA is present, and add IAM users to the groups.

  • Role and group with Administrator (full) access to AWS resources
  • Role and group with Readonly access to AWS resources

To give a user administrator's access, add the user to the admin group.

To give a user readonly access, add the user to the readonly group.

Usage

module "assumed_roles" {
source = "git::https://github.com/cloudposse/terraform-aws-iam-assumed-roles.git?ref=master"
namespace = "cp"
stage = "prod"
admin_name = "admin"
readonly_name = "readonly"
admin_user_names = ["User1","User2"] # Add these IAM users to the admin group
readonly_user_names = ["User3","User4"] # Add these IAM users to the readonly group
}

Requirements

No requirements.

Providers

NameVersion
awsn/a

Modules

NameSourceVersion
admin_labelgit::https://github.com/cloudposse/terraform-null-label.gittags/0.3.3
readonly_labelgit::https://github.com/cloudposse/terraform-null-label.gittags/0.3.3

Resources

NameType
aws_iam_group.adminresource
aws_iam_group.readonlyresource
aws_iam_group_membership.adminresource
aws_iam_group_membership.readonlyresource
aws_iam_group_policy_attachment.allow_chage_password_adminresource
aws_iam_group_policy_attachment.allow_change_password_readonlyresource
aws_iam_group_policy_attachment.assume_role_adminresource
aws_iam_group_policy_attachment.assume_role_readonlyresource
aws_iam_group_policy_attachment.key_management_adminresource
aws_iam_group_policy_attachment.key_management_readonlyresource
aws_iam_group_policy_attachment.manage_mfa_adminresource
aws_iam_group_policy_attachment.manage_mfa_readonlyresource
aws_iam_policy.allow_change_password_adminresource
aws_iam_policy.allow_change_password_readonlyresource
aws_iam_policy.allow_key_management_adminresource
aws_iam_policy.allow_key_management_readonlyresource
aws_iam_policy.assume_role_adminresource
aws_iam_policy.assume_role_readonlyresource
aws_iam_policy.manage_mfa_adminresource
aws_iam_policy.manage_mfa_readonlyresource
aws_iam_role.adminresource
aws_iam_role.readonlyresource
aws_iam_role_policy_attachment.adminresource
aws_iam_role_policy_attachment.readonlyresource
aws_caller_identity.currentdata source
aws_iam_policy_document.allow_change_passworddata source
aws_iam_policy_document.allow_key_managementdata source
aws_iam_policy_document.assume_role_admindata source
aws_iam_policy_document.assume_role_readonlydata source
aws_iam_policy_document.manage_mfadata source
aws_iam_policy_document.role_trustdata source

Inputs

NameDescriptionTypeDefaultRequired
admin_nameName for the admin group and role (e.g. admin)string"admin"no
admin_user_namesOptional list of IAM user names to add to the admin grouplist(string)[]no
attributesAdditional attributes (e.g. policy or role)list(string)[]no
delimiterDelimiter to be used between namespace, stage, name, and attributesstring"-"no
enabledSet to false to prevent the module from creating any resourcesstring"true"no
namespaceNamespace (e.g. cp or cloudposse)stringn/ayes
readonly_nameName for the readonly group and role (e.g. readonly)string"readonly"no
readonly_user_namesOptional list of IAM user names to add to the readonly grouplist(string)[]no
stageStage (e.g. prod, dev, staging)stringn/ayes
switchrole_urlURL to the IAM console to switch to a rolestring"https://signin.aws.amazon.com/switchrole?account=%s&roleName=%s&displayName=%s"no
tagsAdditional tags (e.g. map(BusinessUnit,XYZ)map(string){}no

Outputs

NameDescription
group_admin_arnAdmin group ARN
group_admin_idAdmin group ID
group_admin_nameAdmin group name
group_readonly_arnReadonly group ARN
group_readonly_idReadonly group ID
group_readonly_nameReadonly group name
role_admin_arnAdmin role ARN
role_admin_nameAdmin role name
role_readonly_arnReadonly role ARN
role_readonly_nameReadonly role name
switchrole_admin_urlURL to the IAM console to switch to the admin role
switchrole_readonly_urlURL to the IAM console to switch to the readonly role