Skip to content

Latest commit

 

History

History
25 lines (14 loc) · 1.4 KB

include-deepdive.md

File metadata and controls

25 lines (14 loc) · 1.4 KB

Include Deep Dive

image info

Edit in Eraser

What's going on with the "Include" block, how does it allows us to with keeping DRY (Don't Repeat Yourself), and what is it all about.

What does "include" do?

Similarly to many programming languages, include attributes are executed at the pre-processing stage. The specified target placed in the include block is fetched and slapped onto the current module. This mean that all attributes will be evaluated and expanded prior to the initialization of the module.

Why is it "DRY"?

Instead of defining the entire locals , provider and remote backend placed inside provider.hcl again and again - we only define these setting and calls once, and using a single call from within our module (using the include ).

That allows for:

  • Inheritance of all desired terragrunt files and values placed in of of the module's parent folders.
  • Less prone to error.
  • Dynamically configure values, paths, etc.
  • Define once, reuse as much as you wish.