Skip to content

Consider documenting suggestions for "what makes for a good include block" #5510

@j2udev

Description

@j2udev

Describe the enhancement

It might be nice to have a section in the docs for "what makes for a good include block" or something similar. There are certain things that are great for including across multiple modules (backend config, provider generation, etc), but edge cases exist that can cause real confusion. For example, dependency blocks immediately sound like a good thing to be included (and they are if they are simple), but consider the following dependency block:

dependency "vpc" {
  config_path = "${get_terragrunt_dir()}/../vpc"
  enabled     = try(values.vpc_id, "") == "" ? true : false
}

If I were to include this block likeso:

include "vpc_dependency" { path = "${get_terragrunt_dir()}/../_envcommon/.terragrunt-stack/dependencies/vpc_dependency.hcl" }

The values.vpc_id does not get interpreted at the time of inclusion. Therefore, programmatically enabled dependencies can't work if they are included. Extrapolating further, our team has decided to never include dependencies period in an effort to stay consistent.

This is just one example that we came up with where includes was a bit of a footgun. I imagine there are a few more that we just haven't encountered.

RFC Not Needed

  • [ x ] I have evaluated the complexity of this enhancement, and I believe it does not require an RFC.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestpreservedPreserved issues never go stale

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions