Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated the account.hcl files and added an example file to be able to… #86

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

nilsdebruin
Copy link

… test the assume role functionality. Updated the documentation as well.

Description

Fixes #000.

TODOs

Read the Gruntwork contribution guidelines.

  • Update the docs.
  • Run the relevant tests successfully, including pre-commit checks.
  • Ensure any 3rd party code adheres with our license policy or delete this line if its not applicable.
  • Include release notes. If this PR is backward incompatible, include a migration guide.

Release Notes (draft)

Added / Removed / Updated [X].

Migration Guide

… test the assume role functionality. Updated the documentation as well.
@tamsky
Copy link

tamsky commented Sep 18, 2023

Would it be useful to include/document the alternate implementation that uses iam_role within terragrunt.hcl?

That could look something like:

terragrunt.hcl:
----
locals {
  iam_assume_role_for_this_terraform_stack = "arn:aws:iam::...:role/role_name"
  aws_account_id = "a fixed value" # can't use get_aws_account_id()
  
  # If the aws account ID for the current credentials
  # do not match the expected account_id,
  # switch to using an assumed role.
  maybe_iam_role = (get_aws_account_id() != local.aws_account_id) ? local.iam_assume_role_for_this_terraform_root : ""
}

# changing the value of iam_role potentially alters subsequent
# return values from get_aws_account_id():
iam_role = local.maybe_iam_role

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants