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

Must repeat local blocks in terragrunt.hcl #42

Open
jmcgeheeiv opened this issue Aug 5, 2020 · 3 comments
Open

Must repeat local blocks in terragrunt.hcl #42

jmcgeheeiv opened this issue Aug 5, 2020 · 3 comments

Comments

@jmcgeheeiv
Copy link

jmcgeheeiv commented Aug 5, 2020

Thank you for Terragrunt. It is a fine tool.

It seems to me that local variable definitions are not so DRY. For example, in the sample presented here, the reading of env.hcl and the extraction of variable env is repeated in prod/us-east-1/prod/mysql/terragrunt.hcl and non-prod/us-east-1/qa/webserver-cluster/terragrunt.hcl:

locals {
  # Automatically load environment-level variables
  environment_vars = read_terragrunt_config(find_in_parent_folders("env.hcl"))

  # Extract out common variables for reuse
  env = local.environment_vars.locals.environment
}

Is there no way to put this in the root terragrunt.hcl so that all configurations can reference a single definition of local.env?

@yorinasub17
Copy link
Contributor

Unfortunately we don't yet have a feature to do this. We have a design for something that makes this possible (see https://github.com/gruntwork-io/terragrunt/blob/master/_docs/rfc/imports.md), but we haven't implemented it yet.

@jmcgeheeiv
Copy link
Author

The well-written RFC you cite shows Gruntworks are obviously well aware of the situation. Therefore I will close this issue in deference to the RFC.

@marandalucas
Copy link

@yorinasub17 There are good news? would be possible to implement it? Thanks for all

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

No branches or pull requests

3 participants