Code Monkey home page Code Monkey logo

terraform-aws-iam-cross-acct-dest's Introduction

This module creates a role based on the "iam_role_name" variable that can be assumed by the roles listed in "source_account_role_names" from the account id defined in the "source_account_id" variable.

The role in the source account must exist before creating this resource. This module should be paired with the iam-cross-acct-src module to create a role in the source account with permissions to assume the role created in this module. In certain cases, the trusted relationship between source and destination may be account-based rather than role based.

The source assume role call defaults to requiring MFA.

Philosophical note: There should be a single account in your AWS organization that manages users and groups. In that account, there will be a 1:1 mapping to a group and a role. That role may have AssumeRole permissions to multiple other roles across the accounts in the AWS organization. The role defined in this module should be one of those roles that can be assumed by the role in the original user management account. Generally speaking, the role defined in this module should also map 1:1 to that original group for access concerns. An IAM policy should be defined locally in this account for permissions and assigned to the role defined here.

This module works on GovCloud.

Terraform Versions

Terraform 0.13. Pin module version to ~> 3.X. Submit pull-requests to master branch. Terraform 0.12. Pin module version to ~> 2.0.1. Submit pull-requests to terraform012 branch.

Usage

In most cases, you will just use the source_account_id parameter to trust the user and group managment account; you can then keep all management of which of those users and groups can assume roles there. The following code illustrates that pattern:

module "aws_iam_dest_user_group_role" {
  source  = "trussworks/iam-cross-acct-dest/aws"
  version = "3.0.0"

  iam_role_name     = "group-name"
  source_account_id = "account-id"
}

However, if you want to make the dependency on the source role explicit, you can do it by adding the source_account_role_names parameter, like the following example. This uses IAM role chaining, which is not a recommended method as it institutes a number of restrictions; see the docs for more information.

module "aws_iam_dest_user_group_role" {
  source = "trussworks/iam-cross-acct-dest/aws"
  version = "3.0.0"
  iam_role_name = "group-name"
  source_account_id = "account-id"
  source_account_role_names = ["group-name"]
}

Requirements

Name Version
terraform >= 0.13.0
aws >= 3.0

Providers

Name Version
aws >= 3.0

Inputs

Name Description Type Default Required
iam_role_name The name for the created role. Conceptually, this should correspond to a group. string n/a yes
mfa_condition MFA condition method. Use either Bool or BoolIfExists string "Bool" no
require_mfa Whether the created policy will include MFA. bool true no
role_assumption_max_duration Max duration that the assumed role is assumed for Must be between 3600 and 43200 (including) number 3600 no
source_account_id The account id that the assume role call will be coming from. string n/a yes
source_account_role_names The name of the role that the assume role call will be coming from. Again, this should correspond to a group. list(any) [] no

Outputs

Name Description
iam_role_name The name of the created role.

terraform-aws-iam-cross-acct-dest's People

Contributors

eeeady avatar kilbergr avatar cblkwell avatar mdawn avatar ruzzil avatar linuxbozo avatar esacteksab avatar chrisgilmerproj avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.