Generate projects
Sometimes specifying every project in digger.yml by hand is suboptimal, especially with a large number of small statefiles.
In this scenario you can use the generate_projects
directive in digger.yml. Digger will then traverse the directory according to include_patters
and exclude_patterns
provided and dynamically generate the list of projects
Blocks syntax
You can also specify multiple include / exclude entries like this:
Traversing nested directories
You can optionally set the top-level argument traverse_to_nested_projects
to generate a project for all sub-directories:
This will create a project for all sub-directories under environments/core. If set to false
, only the first directory with a .tf file will be evaluated.
Blocks syntax with Terragrunt
You can use blocks generation with terragrunt as well. In order to achieve this all you need to do is specify
terragrunt: true
for each block. Normally you would only have one terragrunt structure and so you will have
one block entry. However you may be also interested to specify different structure and different parameters
for different folders. For example, you may have a dev, staging and prod account hierarchy and therefore you
would specify the blocks in that way. Alternatively maybe you have different providers and you would like to
specify those different providers as well. Note that for very large terragrunt monorepos segragating by blocks
will lead to improved performance since it will not unnecessarily traverse an entire tree if no files have been
changed within it.