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

Unable to apply multiple modules at once. #3181

Open
RyanW8 opened this issue Jun 3, 2024 · 2 comments
Open

Unable to apply multiple modules at once. #3181

RyanW8 opened this issue Jun 3, 2024 · 2 comments
Assignees
Labels
bug Something isn't working terragrunt

Comments

@RyanW8
Copy link

RyanW8 commented Jun 3, 2024

Describe the bug

Our terragrunt file structure is the following, top level is the application name, 2nd level is account & 3rd is the region. E.g.
Top Level = example_app
2nd Level = example_account
3rd Level = example_region
Would look like

example_app/
  project.hcl
  terragrunt.hcl
  example_account/
    account.hcl
    example_region/
      region.hcl
      terragrunt.hcl

We define what the application terraform should look like at the application/top level like so

terraform {
 ...
}
locals {
  project_locals = read_terragrunt_config(find_in_parent_folders("project.hcl")).locals
  account_locals = read_terragrunt_config(find_in_parent_folders("account.hcl")).locals
  region_locals  = read_terragrunt_config("region.hcl").locals
}
...

child terragrunt.hcl files are located at app_name/account_name/region_name/terragrunt.hcl. And are simple terragrunt files that have an include block for the root terragrunt configuration (defined at the application/top level). In our root terragrunt configuration we define the above locals for all children, basic things like project/app level locals, account level & region level locals.

The issue is we are unable to use the run-all command to apply multiple accounts/regions at any given time as the terragrunt run-all <operation> command first validates/tries to run the root level terragrunt file which is invalid on it's own as the account & region level locals do not exists in that context.

Running plan/apply operation at the region level works correctly as it finds the child terragrunt.hcl

Expected behavior

Be able to run the run-all command from the top/application level

@RyanW8 RyanW8 added the bug Something isn't working label Jun 3, 2024
@RyanW8
Copy link
Author

RyanW8 commented Jun 3, 2024

Looks like skip = true would solve this nicely but it doesn't seem to be functioning as intended at the minute #704. Issue open for a very long time too ):

@denis256
Copy link
Member

denis256 commented Jun 5, 2024

Hi,
I wondered why to have in the project root terragrunt.hcl file?
The include path can reference different file names:

include "root" {
  path = find_in_parent_folders("root.hcl")
}

https://terragrunt.gruntwork.io/docs/reference/built-in-functions/#find_in_parent_folders

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working terragrunt
Projects
None yet
Development

No branches or pull requests

3 participants