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

Parse terragrunt.hcl and inherit terraform_version_constraint from parent #259

Open
marcoreni opened this issue Jul 15, 2022 · 2 comments · May be fixed by #264
Open

Parse terragrunt.hcl and inherit terraform_version_constraint from parent #259

marcoreni opened this issue Jul 15, 2022 · 2 comments · May be fixed by #264
Assignees
Labels
enhancement Refactor existing code for better performance and quality help wanted Extra attention is needed

Comments

@marcoreni
Copy link

marcoreni commented Jul 15, 2022

Is your feature request related to a problem? Please describe.
We're using terragrunt with a nested moule structure, meaning:

stages
└── test
    └── module1
    └── module2
└── prod
    └── module1
    └── module2

We have terragrunt.hcl in both stages/{stage}, to define global parameters, and in stages/{stage}/{module}, where we define the specific module variable.

We locked the terraform_version_constraint inside stages/{stage}. Running tfswitch from module does not work, we are prompted for a version, so we run it from the module folder.

From time to time we override the terraform_constraint in one specific module. In this scenario, we need to run tfswitch inside the module folder.

This is bad DX and causes issues with CI systems, since we do not have a predictable path to run tfswitch in.

Describe the solution you'd like

It would be helpful to be able to parse the hcl file, so that we would inherit the parent declarations, and behave accordingly.

Each of our modules has an include:

include {
  path = find_in_parent_folders()
}

so, by parsing HCL, the terraform_constraint_version may be inherited from the parent.

Describe alternatives you've considered

Additional context

@marcoreni marcoreni added the enhancement Refactor existing code for better performance and quality label Jul 15, 2022
@marcoreni marcoreni changed the title Parse terragrunt.hcl and Parse terragrunt.hcl and inherit terraform_version_constraint from parent Jul 15, 2022
@marcoreni marcoreni linked a pull request Jul 22, 2022 that will close this issue
@Tensho
Copy link

Tensho commented Jul 25, 2022

Have the same use case. Would be nice to have a hierarchical version switch.

@elopsod
Copy link

elopsod commented Oct 3, 2022

Would be nice to have a hierarchical version switch.

@MatrixCrawler MatrixCrawler linked a pull request Apr 4, 2024 that will close this issue
@MatrixCrawler MatrixCrawler removed a link to a pull request Apr 4, 2024
@MatrixCrawler MatrixCrawler added the help wanted Extra attention is needed label Apr 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Refactor existing code for better performance and quality help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants