You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently when using terragrunt catalog and/or scaffold, the scaffold command runs a hclfmt on the working directory. This can subsequently end up touching far more files than just the ones that the scaffold command created. Ideally, the hclfmt is either made optional, or only runs against the terragrunt files that scaffold itself generated.
Additional context
It seems to me that the current assumption is that people would run scaffold from the directory they want to generate terragrunt files in. Given that assumption the idea of running the hclfmt on the working directory isn't a terrible one. However, terragrunt's own architecture proposal is to use a base/child structure. The easiest way I've found to have scaffold generate both a base and a child terragrunt file, is by running scaffold from the root of the repo (and have the user input the file paths for both directories). This is reasonably easy to achieve using boilerplate dependencies.
The biggest problem I'm facing is that running the terragrunt scaffold from the root of the directory will run the hclfmt against the entire repo, instead of just the two (or more) subfolders that the command itself created.
Example
The below boilerplate template essentially just created two dependencies in two folders, the path of which is required as user input.
variables:
- name: sourceUrldescription: Url for source moduletype: stringdefault: ""
- name: requiredVariablesdescription: Required input variables for moduletype: listdefault: []
- name: optionalVariablesdescription: Optional input variables for moduletype: listdefault: []
- name: baseFileNamedescription: Name for the base terragrunt file WITHOUT file extension, e.g. "dynamodb". (NOT "terragrunt")type: stringvalidations:
- required
- length-3-50
- name: baseFilePathdescription: |- Path for the base file, e.g. "base/team/service/" DO NOT add a leading slash, DO add a trailing slash type: stringvalidations:
- required
- length-5-500
- name: leafFilePathdescription: |- Path for the leaf file, e.g. "development/us-east-1/team/service/" DO NOT add a leading slash, DO add a trailing slash type: stringvalidations:
- required
- length-5-500partials:
- ../.boilerplate-files/boilerplate-partials/*.hcldependencies:
- name: basetemplate-url: ../.boilerplate-files/base-fileoutput-folder: "{{ .baseFilePath }}"
- name: leaftemplate-url: ../.boilerplate-files/leaf-fileoutput-folder: "{{ .leafFilePath }}"
(dependency templates not included for brevity)
Technically you can run this from anywhere in the repo, but the most logical place to run the scaffold command for the above boilerplate template is the root of the repo. All files generated will be in subfolders, so running hclfmt against the entire working directory is not ideal, as it may touch a whole list of files which are not in any way related to the scaffold call.
The text was updated successfully, but these errors were encountered:
Describe the enhancement
Currently when using terragrunt catalog and/or scaffold, the scaffold command runs a
hclfmt
on the working directory. This can subsequently end up touching far more files than just the ones that the scaffold command created. Ideally, thehclfmt
is either made optional, or only runs against the terragrunt files that scaffold itself generated.Additional context
It seems to me that the current assumption is that people would run scaffold from the directory they want to generate terragrunt files in. Given that assumption the idea of running the
hclfmt
on the working directory isn't a terrible one. However, terragrunt's own architecture proposal is to use a base/child structure. The easiest way I've found to have scaffold generate both a base and a child terragrunt file, is by running scaffold from the root of the repo (and have the user input the file paths for both directories). This is reasonably easy to achieve using boilerplate dependencies.The biggest problem I'm facing is that running the terragrunt scaffold from the root of the directory will run the
hclfmt
against the entire repo, instead of just the two (or more) subfolders that the command itself created.Example
The below boilerplate template essentially just created two dependencies in two folders, the path of which is required as user input.
(dependency templates not included for brevity)
Technically you can run this from anywhere in the repo, but the most logical place to run the scaffold command for the above boilerplate template is the root of the repo. All files generated will be in subfolders, so running hclfmt against the entire working directory is not ideal, as it may touch a whole list of files which are not in any way related to the scaffold call.
The text was updated successfully, but these errors were encountered: