-
-
Notifications
You must be signed in to change notification settings - Fork 965
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
Add built-in function to get_aws_account_alias
#1615
Comments
Thx for filing this issue and the PR. Taking a step back, I'm a little worried that adding more and more AWS-specific helpers will end up bloating the Terragrunt API, making it harder to use, and making it harder to maintain. The generic functions related to Terragrunt/Terratest (e.g., I'm tempted to put a cap on it now, and not add any new cloud-specific functions. Perhaps in the future, we even deprecate the existing ones. I believe locals {
aws_account_id = run_cmd("aws", "sts", "get-caller-identity", "--output", "text", "--query", "Account")
aws_account_alias = run_cmd("aws", "iam", "list-account-aliases", "--output", "text", "--query", "AccountAliases")
} That said, I'm open to other opinions. @yorinasub17 and @infraredgirl I'd value your input on this too! |
I actually really like the suggestion and completely agree it becomes dangerous to keep adding provider specific code. Any ideas on a good docker image (for use in CI) that already has Terragrunt, Terraform, and AWS CLI setup? I was previously using |
Agreed with your assessment here. You can even use |
Accounts are often provisioned with several items named using the account alias and it would be helpful to have this helper be able to fetch this value for the terragrunt config.
Another use case is naming your var files something like
my-account-name.tfvars
which helps identify which account/environment this file should be used for and is more human friendly than an account number. If terragrunt could look this up you could have it dynamically load the correct var file based on the current account the user is logged into.Below is an example of using this name as the mechanism to load the correct
.tfvars
file:I am hoping to work on a PR for this soon and would love any comments and/or suggestions!
The text was updated successfully, but these errors were encountered: