├── .deepsource.toml ├── Makefile ├── .gitignore ├── .github ├── CODEOWNERS ├── workflows │ ├── tfsec.yml │ ├── tflint.yml │ ├── tf-checks.yml │ ├── automerge.yml │ ├── changelog.yml │ ├── auto_assignee.yml │ └── readme.yml ├── PULL_REQUEST_TEMPLATE.md └── dependabot.yml ├── versions.tf ├── examples ├── versions.tf ├── outputs.tf └── example.tf ├── .pre-commit-config.yaml ├── outputs.tf ├── main.tf ├── README.yaml ├── docs └── io.md ├── CHANGELOG.md ├── variables.tf ├── README.md └── LICENSE /.deepsource.toml: -------------------------------------------------------------------------------- 1 | version = 1 2 | 3 | [[analyzers]] 4 | name = "terraform" 5 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | export GENIE_PATH ?= $(shell 'pwd')/../../../genie 2 | 3 | include $(GENIE_PATH)/Makefile -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # ignored files 2 | *.tfstate 3 | *.tfstate.backup 4 | .terraform 5 | .idea 6 | *.iml 7 | .*terraform.lock.hcl -------------------------------------------------------------------------------- /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | # These owners will be the default owners for everything in the repo. 2 | * @anmolnagpal @clouddrove/approvers @clouddrove-ci 3 | -------------------------------------------------------------------------------- /versions.tf: -------------------------------------------------------------------------------- 1 | # Terraform version 2 | terraform { 3 | required_version = ">= 1.6.6" 4 | 5 | required_providers { 6 | aws = { 7 | source = "hashicorp/aws" 8 | version = ">= 5.31.0" 9 | } 10 | } 11 | } -------------------------------------------------------------------------------- /examples/versions.tf: -------------------------------------------------------------------------------- 1 | # Terraform version 2 | terraform { 3 | required_version = ">= 1.6.6" 4 | 5 | required_providers { 6 | aws = { 7 | source = "hashicorp/aws" 8 | version = ">= 5.31.0" 9 | } 10 | } 11 | } -------------------------------------------------------------------------------- /.github/workflows/tfsec.yml: -------------------------------------------------------------------------------- 1 | name: tfsec 2 | permissions: write-all 3 | on: 4 | pull_request: 5 | workflow_dispatch: 6 | jobs: 7 | tfsec: 8 | uses: clouddrove/github-shared-workflows/.github/workflows/tfsec.yml@master 9 | secrets: inherit 10 | with: 11 | working_directory: '.' 12 | -------------------------------------------------------------------------------- /.github/workflows/tflint.yml: -------------------------------------------------------------------------------- 1 | name: tf-lint 2 | on: 3 | push: 4 | branches: [ master ] 5 | pull_request: 6 | workflow_dispatch: 7 | jobs: 8 | tf-lint: 9 | uses: clouddrove/github-shared-workflows/.github/workflows/tf-lint.yml@master 10 | secrets: 11 | GITHUB: ${{ secrets.GITHUB }} 12 | -------------------------------------------------------------------------------- /.github/workflows/tf-checks.yml: -------------------------------------------------------------------------------- 1 | name: tf-checks 2 | on: 3 | push: 4 | branches: [ master ] 5 | pull_request: 6 | workflow_dispatch: 7 | jobs: 8 | _example: 9 | uses: clouddrove/github-shared-workflows/.github/workflows/tf-checks.yml@master 10 | with: 11 | working_directory: './examples/' 12 | -------------------------------------------------------------------------------- /.github/workflows/automerge.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Auto merge 3 | on: 4 | pull_request: 5 | jobs: 6 | auto-merge: 7 | uses: clouddrove/github-shared-workflows/.github/workflows/auto_merge.yml@master 8 | secrets: 9 | GITHUB: ${{ secrets.GITHUB }} 10 | with: 11 | tfcheck: 'examples / Check code format' 12 | ... 13 | -------------------------------------------------------------------------------- /.github/workflows/changelog.yml: -------------------------------------------------------------------------------- 1 | name: changelog 2 | permissions: write-all 3 | on: 4 | push: 5 | tags: 6 | - "*" 7 | workflow_dispatch: 8 | jobs: 9 | changelog: 10 | uses: clouddrove/github-shared-workflows/.github/workflows/changelog.yml@master 11 | secrets: inherit 12 | with: 13 | branch: 'master' 14 | -------------------------------------------------------------------------------- /examples/outputs.tf: -------------------------------------------------------------------------------- 1 | #Module : AWS IAM ROLE 2 | #Description : Provides an IAM role. 3 | output "role_arn" { 4 | value = module.cross-access-role.role_arn 5 | description = "The status of the VPC peering connection request." 6 | } 7 | 8 | output "tags" { 9 | value = module.cross-access-role.tags 10 | description = "A mapping of tags to assign to the role." 11 | } -------------------------------------------------------------------------------- /.github/workflows/auto_assignee.yml: -------------------------------------------------------------------------------- 1 | name: Auto Assign PRs 2 | 3 | on: 4 | pull_request: 5 | types: [opened, reopened] 6 | 7 | workflow_dispatch: 8 | jobs: 9 | assignee: 10 | uses: clouddrove/github-shared-workflows/.github/workflows/auto_assignee.yml@master 11 | secrets: 12 | GITHUB: ${{ secrets.GITHUB }} 13 | with: 14 | assignees: 'clouddrove-ci' 15 | -------------------------------------------------------------------------------- /.pre-commit-config.yaml: -------------------------------------------------------------------------------- 1 | repos: 2 | - repo: git://github.com/antonbabenko/pre-commit-terraform 3 | rev: v1.43.0 4 | hooks: 5 | - id: terraform_fmt 6 | 7 | - repo: https://github.com/pre-commit/pre-commit-hooks 8 | rev: v3.2.0 9 | hooks: 10 | - id: check-merge-conflict 11 | - id: check-yaml 12 | - id: check-added-large-files 13 | - id: trailing-whitespace -------------------------------------------------------------------------------- /.github/workflows/readme.yml: -------------------------------------------------------------------------------- 1 | name: 'Readme Workflow' 2 | on: 3 | push: 4 | branches: 5 | - master 6 | paths-ignore: 7 | - 'README.md' 8 | - 'docs/**' 9 | workflow_dispatch: 10 | 11 | jobs: 12 | README: 13 | uses: clouddrove/github-shared-workflows/.github/workflows/readme.yml@master 14 | secrets: 15 | TOKEN : ${{ secrets.GITHUB }} 16 | SLACK_WEBHOOK_TERRAFORM: ${{ secrets.SLACK_WEBHOOK_TERRAFORM }} -------------------------------------------------------------------------------- /examples/example.tf: -------------------------------------------------------------------------------- 1 | provider "aws" { 2 | region = "eu-west-1" 3 | } 4 | 5 | module "cross-access-role" { 6 | source = "../" 7 | 8 | name = "iam-role" 9 | environment = "test1" 10 | enabled = true 11 | label_order = ["environment", "name"] 12 | 13 | master_account_user = "arn:aws:iam::xxxxxxxxx:root" 14 | policy_arn = ["arn:aws:iam::aws:policy/AdministratorAccess", "arn:aws:iam::aws:policy/ReadOnlyAccess"] 15 | } 16 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | ## what 2 | * Describe high-level what changed as a result of these commits (i.e. in plain-english, what do these changes mean?) 3 | * Use bullet points to be concise and to the point. 4 | 5 | ## why 6 | * Provide the justifications for the changes (e.g. business case). 7 | * Describe why these changes were made (e.g. why do these commits fix the problem?) 8 | * Use bullet points to be concise and to the point. 9 | 10 | ## references 11 | * Link to any supporting jira issues or helpful documentation to add some context (e.g. stackoverflow). 12 | * Use `closes #123`, if this PR closes a Jira issue `#123` 13 | -------------------------------------------------------------------------------- /outputs.tf: -------------------------------------------------------------------------------- 1 | #Module : AWS IAM ROLE 2 | #Description : Provides an IAM role. 3 | output "role_name" { 4 | value = aws_iam_role.default.*.name 5 | description = "The name of the crated role." 6 | } 7 | 8 | output "role_id" { 9 | value = aws_iam_role.default.*.unique_id 10 | description = "The stable and unique string identifying the role." 11 | } 12 | 13 | output "role_arn" { 14 | value = aws_iam_role.default.*.arn 15 | description = "The Amazon Resource Name (ARN) specifying the role." 16 | } 17 | 18 | output "tags" { 19 | value = module.labels.tags 20 | description = "A mapping of tags to assign to the resource." 21 | } 22 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | # To get started with Dependabot version updates, you'll need to specify which 2 | # package ecosystems to update and where the package manifests are located. 3 | # Please see the documentation for all configuration options: 4 | # https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates 5 | version: 2 6 | updates: 7 | - package-ecosystem: "terraform" # See documentation for possible values 8 | directory: "/" # Location of package manifests 9 | schedule: 10 | interval: "weekly" 11 | # Add assignees 12 | assignees: 13 | - "clouddrove-ci" 14 | # Add reviewer 15 | reviewers: 16 | - "approvers" 17 | - package-ecosystem: "terraform" # See documentation for possible values 18 | directory: "examples/" # Location of package manifests 19 | schedule: 20 | interval: "weekly" 21 | # Add assignees 22 | assignees: 23 | - "clouddrove-ci" 24 | # Add reviewer 25 | reviewers: 26 | - "approvers" 27 | 28 | -------------------------------------------------------------------------------- /main.tf: -------------------------------------------------------------------------------- 1 | # Managed By : CloudDrove 2 | # Description : This Script is used to Create iam Role and Policy. 3 | # Copyright @ CloudDrove. All Right Reserved. 4 | 5 | #Module : Label 6 | #Description : This terraform module is designed to generate consistent label names and 7 | # tags for resources. You can use terraform-labels to implement a strict 8 | # naming convention. 9 | module "labels" { 10 | source = "clouddrove/labels/aws" 11 | version = "1.3.0" 12 | 13 | enabled = var.enabled 14 | name = var.name 15 | repository = var.repository 16 | environment = var.environment 17 | managedby = var.managedby 18 | attributes = var.attributes 19 | label_order = var.label_order 20 | } 21 | 22 | data "aws_iam_policy_document" "assume_role" { 23 | statement { 24 | actions = [ 25 | "sts:AssumeRole", 26 | ] 27 | principals { 28 | type = "AWS" 29 | identifiers = [var.master_account_user] 30 | } 31 | effect = "Allow" 32 | } 33 | } 34 | 35 | #Module : AWS IAM ROLE 36 | #Description : Provides an IAM role. 37 | resource "aws_iam_role" "default" { 38 | count = var.enabled ? 1 : 0 39 | name = module.labels.id 40 | assume_role_policy = data.aws_iam_policy_document.assume_role.json 41 | description = var.description 42 | tags = module.labels.tags 43 | force_detach_policies = var.force_detach_policies 44 | max_session_duration = var.max_session_duration 45 | } 46 | 47 | #Module : AWS IAM ROLE POLICY ATTACHMENT 48 | #Description : PAttaches a Managed IAM Policy to an IAM role. 49 | resource "aws_iam_role_policy_attachment" "default" { 50 | count = var.enabled ? length(var.policy_arn) : 0 51 | role = join("", aws_iam_role.default.*.name) 52 | policy_arn = element(distinct(compact(concat(var.policy_arn))), count.index) 53 | } 54 | 55 | resource "aws_iam_role_policy" "default" { 56 | count = var.enabled && var.policy_enabled && var.policy_arn == "" ? 1 : 0 57 | name = format("%s-policy", module.labels.id) 58 | role = join("", aws_iam_role.default.*.name) 59 | policy = var.policy 60 | } 61 | 62 | -------------------------------------------------------------------------------- /README.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | # 3 | # This is the canonical configuration for the `README.md` 4 | # Run `make readme` to rebuild the `README.md` 5 | # 6 | 7 | # Name of this project 8 | name : Terraform AWS Cross Account Role 9 | 10 | # License of this project 11 | license: "APACHE" 12 | 13 | # Canonical GitHub repo 14 | github_repo: clouddrove/terraform-aws-cross-account-role 15 | 16 | # Badges to display 17 | badges: 18 | - name: "Latest Release" 19 | image: "https://img.shields.io/github/release/clouddrove/terraform-aws-cross-account-role.svg" 20 | url: "https://github.com/clouddrove/terraform-aws-cross-account-role/releases/latest" 21 | - name: "tfsec" 22 | image: "https://github.com/clouddrove/terraform-aws-cross-account-role/actions/workflows/tfsec.yml/badge.svg" 23 | url: "https://github.com/clouddrove/terraform-aws-cross-account-role/actions/workflows/tfsec.yml" 24 | - name: "Licence" 25 | image: "https://img.shields.io/badge/License-APACHE-blue.svg" 26 | url: "LICENSE.md" 27 | - name: "Changelog" 28 | image: "https://img.shields.io/badge/Changelog-blue" 29 | url: "CHANGELOG.md" 30 | 31 | prerequesties: 32 | - name: Terraform 33 | url: https://learn.hashicorp.com/terraform/getting-started/install.html 34 | version: ">= 1.6.6" 35 | 36 | providers: 37 | - name: aws 38 | url: https://aws.amazon.com/ 39 | version: ">= 5.31.0" 40 | 41 | module_dependencies: 42 | - name: Labels Module 43 | url: https://github.com/clouddrove/terraform-aws-labels 44 | description: Provides resource tagging. 45 | 46 | # description of this project 47 | description: |- 48 | This terraform module is used for creating an IAM Role which can give permission to another AWS account for accessing it's inventory. 49 | # extra content 50 | include: 51 | - "terraform.md" 52 | 53 | # How to use this project 54 | usage : |- 55 | ### Simple Example 56 | Here are an example of how you can use this module in your inventory structure: 57 | ```hcl 58 | module "cross-access-role" { 59 | source = "clouddrove/cross-account-role/aws" 60 | version = "1.0.1" 61 | name = "iam-role" 62 | environment = "test" 63 | label_order = ["environment", "name", "application"] 64 | master_account_id = "xxxxxxxxxx" 65 | policy_arn = "arn:aws:iam::aws:policy/AdministratorAccess" 66 | } 67 | ``` -------------------------------------------------------------------------------- /docs/io.md: -------------------------------------------------------------------------------- 1 | ## Inputs 2 | 3 | | Name | Description | Type | Default | Required | 4 | |------|-------------|------|---------|:--------:| 5 | | attributes | Additional attributes (e.g. `1`). | `list(any)` | `[]` | no | 6 | | description | Description of IAM Role. | `string` | `"The role to grant permissions to this account to delegated IAM users in the master account."` | no | 7 | | enabled | Enabled to create module or not. | `bool` | `true` | no | 8 | | environment | Environment (e.g. `prod`, `dev`, `staging`). | `string` | `""` | no | 9 | | force\_detach\_policies | (Optional) Specifies to force detaching any policies the role has before destroying it. Defaults to false | `bool` | `false` | no | 10 | | label\_order | Label order, e.g. `name`,`application`. | `list(any)` | `[]` | no | 11 | | managedby | ManagedBy, eg 'CloudDrove' or 'AnmolNagpal'. | `string` | `"anmol@clouddrove.com"` | no | 12 | | master\_account\_user | The ID of the master account to Read Only Access the current account. | `string` | n/a | yes | 13 | | max\_session\_duration | - (Optional) The maximum session duration (in seconds) that you want to set for the specified role. If you do not specify a value for this setting, the default maximum of one hour is applied. This setting can have a value from 1 hour to 12 hours. | `string` | `"3600"` | no | 14 | | name | Name (e.g. `app` or `cluster`). | `string` | `""` | no | 15 | | policy | Policy ARN to attach to the role. By default it attaches `AdministratorAccess` managed policy to grant full access to AWS services and resources in the current account. | `string` | `""` | no | 16 | | policy\_arn | Policy ARN to attach to the role. By default it attaches `AdministratorAccess` managed policy to grant full access to AWS services and resources in the current account. | `list(string)` | `[]` | no | 17 | | policy\_enabled | Enabled to create module or not. | `bool` | `false` | no | 18 | | repository | Terraform current module repo | `string` | `"https://github.com/clouddrove/terraform-aws-cross-account-role"` | no | 19 | | tags | Additional tags (e.g. map(`BusinessUnit`,`XYZ`). | `map(string)` | `{}` | no | 20 | 21 | ## Outputs 22 | 23 | | Name | Description | 24 | |------|-------------| 25 | | role\_arn | The Amazon Resource Name (ARN) specifying the role. | 26 | | role\_id | The stable and unique string identifying the role. | 27 | | role\_name | The name of the crated role. | 28 | | tags | A mapping of tags to assign to the resource. | 29 | 30 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | All notable changes to this project will be documented in this file. 3 | 4 | The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), 5 | and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). 6 | 7 | ## [0.15.0] - 2021-07-14 8 | ### :bug: Bug Fixes 9 | - [`d59c16f`](https://github.com/clouddrove/terraform-aws-cross-account-role/commit/d59c16f0242017e06661a044ab6022b78f24c301) - update github-action 10 | 11 | ## [0.14.1] - 2021-06-30 12 | ### :bug: Bug Fixes 13 | - [`52b3080`](https://github.com/clouddrove/terraform-aws-cross-account-role/commit/52b3080007eb27b4d4cd7a51b68782a6bffc5a83) - fix terratest 14 | - [`414bec8`](https://github.com/clouddrove/terraform-aws-cross-account-role/commit/ea6dc616f4c469cdd49b34879bec0c70a0bae2af) - update github-action and module tags and update in 0.15 15 | 16 | ## [0.14.0] - 2021-04-15 17 | ### :sparkles: New Features 18 | - [`4d8a48f`](https://github.com/clouddrove/terraform-aws-cross-account-role/commit/4d8a48f927ebfce4862c595278abcc5863720cf9) - add multi arn 19 | - [`4ed7d92`](https://github.com/clouddrove/terraform-aws-cross-account-role/commit/4ed7d92328affc772978fe78512c242a40695c0c) - Add policy opation 20 | 21 | ## [0.13.0] - 2020-11-19 22 | ### :bug: Bug Fixes 23 | - [`1ae1759`](https://github.com/clouddrove/terraform-aws-cross-account-role/commit/1ae1759a89d22ade9936559500828f2d38558195) - fix variable 24 | - [`e656b5b`](https://github.com/clouddrove/terraform-aws-cross-account-role/commit/e656b5b3fb0d4500db063bcfa53639f8bb227ebe) - fix it for all user 25 | - [`c2c7dd7`](https://github.com/clouddrove/terraform-aws-cross-account-role/commit/c2c7dd7dbdf6d7f85603fa54637fcca3d5dd2ae0) - upgrade to 0.14 26 | 27 | ## [0.12.2] - 2020-05-24 28 | ### :bug: Bug Fixes 29 | - [`cd66d0a`](https://github.com/clouddrove/terraform-aws-cross-account-role/commit/e656b5b3fb0d4500db063bcfa53639f8bb227ebe) - fix it for all user 30 | - [`c2c7dd7`](https://github.com/clouddrove/terraform-aws-cross-account-role/commit/cd66d0a196c6bc38efd9de3a21bfd9c1abf37d35) - fix labels managedby variables 31 | 32 | ## [0.12.1] - 2020-04-30 33 | ### :bug: Bug Fixes 34 | - [`c2c7dd7`](https://github.com/clouddrove/terraform-aws-cross-account-role/commit/cd66d0a196c6bc38efd9de3a21bfd9c1abf37d35) - fix labels managedby variables 35 | 36 | ## [0.12.0] - 2019-09-06 37 | ### :bug: Bug Fixes 38 | - [`6fddf3d`](https://github.com/clouddrove/terraform-aws-cross-account-role/commit/6fddf3d14502212921010f4b259ba86b5b95feed) - update readme 39 | 40 | 41 | [0.12.0]: https://github.com/clouddrove/terraform-aws-cross-account-role/compare/0.12.0...master 42 | [0.12.1]: https://github.com/clouddrove/terraform-aws-cross-account-role/compare/0.12.1...master 43 | [0.12.2]: https://github.com/clouddrove/terraform-aws-cross-account-role/compare/0.12.2...master 44 | [0.13.0]: https://github.com/clouddrove/terraform-aws-cross-account-role/compare/0.13.0...master 45 | [0.14.0]: https://github.com/clouddrove/terraform-aws-cross-account-role/compare/0.14.0...master 46 | [0.14.1]: https://github.com/clouddrove/terraform-aws-cross-account-role/compare/0.14.1...master 47 | [0.15.0]: https://github.com/clouddrove/terraform-aws-cross-account-role/compare/0.15.0...master 48 | -------------------------------------------------------------------------------- /variables.tf: -------------------------------------------------------------------------------- 1 | #Module : LABEL 2 | #Description : Terraform label module variables. 3 | variable "name" { 4 | type = string 5 | default = "" 6 | description = "Name (e.g. `app` or `cluster`)." 7 | } 8 | 9 | variable "repository" { 10 | type = string 11 | default = "https://github.com/clouddrove/terraform-aws-cross-account-role" 12 | description = "Terraform current module repo" 13 | 14 | validation { 15 | # regex(...) fails if it cannot find a match 16 | condition = can(regex("^https://", var.repository)) 17 | error_message = "The module-repo value must be a valid Git repo link." 18 | } 19 | } 20 | 21 | variable "attributes" { 22 | type = list(any) 23 | default = [] 24 | description = "Additional attributes (e.g. `1`)." 25 | } 26 | 27 | variable "environment" { 28 | type = string 29 | default = "" 30 | description = "Environment (e.g. `prod`, `dev`, `staging`)." 31 | } 32 | 33 | variable "label_order" { 34 | type = list(any) 35 | default = [] 36 | description = "Label order, e.g. `name`,`application`." 37 | } 38 | 39 | variable "tags" { 40 | type = map(string) 41 | default = {} 42 | description = "Additional tags (e.g. map(`BusinessUnit`,`XYZ`)." 43 | } 44 | 45 | variable "managedby" { 46 | type = string 47 | default = "anmol@clouddrove.com" 48 | description = "ManagedBy, eg 'CloudDrove' or 'AnmolNagpal'." 49 | } 50 | 51 | 52 | variable "master_account_user" { 53 | type = string 54 | description = "The ID of the master account to Read Only Access the current account." 55 | } 56 | 57 | 58 | variable "description" { 59 | type = string 60 | default = "The role to grant permissions to this account to delegated IAM users in the master account." 61 | description = "Description of IAM Role." 62 | } 63 | 64 | variable "policy_arn" { 65 | type = list(string) 66 | default = [] 67 | description = "Policy ARN to attach to the role. By default it attaches `AdministratorAccess` managed policy to grant full access to AWS services and resources in the current account." 68 | } 69 | 70 | variable "enabled" { 71 | type = bool 72 | default = true 73 | description = "Enabled to create module or not." 74 | } 75 | 76 | variable "max_session_duration" { 77 | type = string 78 | default = "3600" 79 | description = " - (Optional) The maximum session duration (in seconds) that you want to set for the specified role. If you do not specify a value for this setting, the default maximum of one hour is applied. This setting can have a value from 1 hour to 12 hours." 80 | } 81 | 82 | variable "force_detach_policies" { 83 | type = bool 84 | default = false 85 | description = "(Optional) Specifies to force detaching any policies the role has before destroying it. Defaults to false" 86 | } 87 | 88 | variable "policy" { 89 | type = string 90 | default = "" 91 | description = "Policy ARN to attach to the role. By default it attaches `AdministratorAccess` managed policy to grant full access to AWS services and resources in the current account." 92 | } 93 | 94 | variable "policy_enabled" { 95 | type = bool 96 | default = false 97 | description = "Enabled to create module or not." 98 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | [![Banner](https://github.com/clouddrove/terraform-module-template/assets/119565952/67a8a1af-2eb7-40b7-ae07-c94cde9ce062)][website] 3 |

4 | Terraform AWS Cross Account Role 5 |

6 | 7 |

8 | With our comprehensive DevOps toolkit - streamline operations, automate workflows, enhance collaboration and, most importantly, deploy with confidence. 9 |

10 | 11 | 12 |

13 | 14 | 15 | Latest Release 16 | 17 | 18 | tfsec 19 | 20 | 21 | Licence 22 | 23 | 24 | Changelog 25 | 26 | 27 | 28 |

29 |

30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 |

45 |
46 | 47 | 48 | We are a group of DevOps engineers & architects, joining hands in this ever evolving digital landscape. With our strong belief in Automation; just like microservices, always on the lookout to split the the infrastructure into smaller connected resources (database, cluster and more) which could be standardized, are manageable, scalable, secure & follow industry best practices. 49 | 50 | 51 | This module includes Terraform open source, examples, and automation tests (for better understanding), which would help you create and improve your infrastructure with minimalistic coding. 52 | 53 | 54 | 55 | 56 | ## Prerequisites and Providers 57 | 58 | This table contains both Prerequisites and Providers: 59 | 60 | | Description | Name | Version | 61 | |:-------------:|:-------------------------------------------:|:---------:| 62 | | **Prerequisite** | [Terraform](https://learn.hashicorp.com/terraform/getting-started/install.html) | >= 1.6.6 | 63 | | **Provider** | [aws](https://aws.amazon.com/) | >= 5.31.0 | 64 | 65 | 66 | 67 | 68 | 69 | ## Examples 70 | 71 | **IMPORTANT:** Since the master branch used in source varies based on new modifications, we recommend using the [release versions](https://github.com/clouddrove/terraform-aws-cross-account-role/releases). 72 | 73 | 📌 For additional usage examples, check the complete list under [`examples/`](./examples) directory. 74 | 75 | 76 | 77 | ## Inputs and Outputs 78 | 79 | Refer to complete documentation: [here](docs/io.md) 80 | 81 | 82 | 93 | 94 | 95 | ## Module Dependencies 96 | 97 | This module has dependencies on: 98 | - [Labels Module](https://github.com/clouddrove/terraform-aws-labels): Provides resource tagging. 99 | 100 | 101 | ## 📑 Changelog 102 | 103 | Refer [here](CHANGELOG.md). 104 | 105 | 106 | 107 | 108 | ## ✨ Contributors 109 | 110 | Big thanks to our contributors for elevating our project with their dedication and expertise! But, we do not wish to stop there, would like to invite contributions from the community in improving these projects and making them more versatile for better reach. Remember, every bit of contribution is immensely valuable, as, together, we are moving in only 1 direction, i.e. forward. 111 | 112 | 113 | 114 | 115 |
116 |
117 | 118 | If you're considering contributing to our project, here are a few quick guidelines that we have been following (Got a suggestion? We are all ears!): 119 | 120 | - **Fork the Repository:** Create a new branch for your feature or bug fix. 121 | - **Coding Standards:** You know the drill. 122 | - **Clear Commit Messages:** Write clear and concise commit messages to facilitate understanding. 123 | - **Thorough Testing:** Test your changes thoroughly before submitting a pull request. 124 | - **Documentation Updates:** Include relevant documentation updates if your changes impact it. 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | ## Feedback 139 | Spot a bug or have thoughts to share with us? Let's squash it together! Log it in our [issue tracker](https://github.com/clouddrove/terraform-aws-cross-account-role/issues), feel free to drop us an email at [hello@clouddrove.com](mailto:hello@clouddrove.com). 140 | 141 | Show some love with a ★ on [our GitHub](https://github.com/clouddrove/terraform-aws-cross-account-role)! if our work has brightened your day! – your feedback fuels our journey! 142 | 143 | 144 | ## :rocket: Our Accomplishment 145 | 146 | We have [*100+ Terraform modules*][terraform_modules] 🙌. You could consider them finished, but, with enthusiasts like yourself, we are able to ever improve them, so we call our status - improvement in progress. 147 | 148 | - [Terraform Module Registry:](https://registry.terraform.io/namespaces/clouddrove) Discover our Terraform modules here. 149 | 150 | - [Terraform Modules for AWS/Azure Modules:](https://github.com/clouddrove/toc) Explore our comprehensive Table of Contents for easy navigation through our documentation for modules pertaining to AWS, Azure & GCP. 151 | 152 | - [Terraform Modules for Digital Ocean:](https://github.com/terraform-do-modules/toc) Check out our specialized Terraform modules for Digital Ocean. 153 | 154 | 155 | 156 | 157 | ## Join Our Slack Community 158 | 159 | Join our vibrant open-source slack community and embark on an ever-evolving journey with CloudDrove; helping you in moving upwards in your career path. 160 | Join our vibrant Open Source Slack Community and embark on a learning journey with CloudDrove. Grow with us in the world of DevOps and set your career on a path of consistency. 161 | 162 | 🌐💬What you'll get after joining this Slack community: 163 | 164 | - 🚀 Encouragement to upgrade your best version. 165 | - 🌈 Learning companionship with our DevOps squad. 166 | - 🌱 Relentless growth with daily updates on new advancements in technologies. 167 | 168 | Join our tech elites [Join Now][slack] 🚀 169 | 170 | 171 | ## Explore Our Blogs 172 | 173 | Click [here][blog] :books: :star2: 174 | 175 | ## Tap into our capabilities 176 | We provide a platform for organizations to engage with experienced top-tier DevOps & Cloud services. Tap into our pool of certified engineers and architects to elevate your DevOps and Cloud Solutions. 177 | 178 | At [CloudDrove][website], has extensive experience in designing, building & migrating environments, securing, consulting, monitoring, optimizing, automating, and maintaining complex and large modern systems. With remarkable client footprints in American & European corridors, our certified architects & engineers are ready to serve you as per your requirements & schedule. Write to us at [business@clouddrove.com](mailto:business@clouddrove.com). 179 | 180 |

We are The Cloud Experts!

181 |
182 |

We ❤️ Open Source and you can check out our other modules to get help with your new Cloud ideas.

183 | 184 | [website]: https://clouddrove.com 185 | [blog]: https://blog.clouddrove.com 186 | [slack]: https://www.launchpass.com/devops-talks 187 | [github]: https://github.com/clouddrove 188 | [linkedin]: https://cpco.io/linkedin 189 | [twitter]: https://twitter.com/clouddrove/ 190 | [email]: https://clouddrove.com/contact-us.html 191 | [terraform_modules]: https://github.com/clouddrove?utf8=%E2%9C%93&q=terraform-&type=&language= 192 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright 2021 CloudDrove Inc. 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. --------------------------------------------------------------------------------