Handling dependencies

Hi, I’m trying to understand how to best manage dependencies. I read this section: https://github.com/gruntwork-io/terragrunt#dependencies-between-modules, but I’m not clear on whether the dependencies block should go in terraform.hcl’s in my “live” or “modules” repository.

Also, I’m trying to understand the pros/cons of this approach vs having your ‘live’ setup explicitly link say an input of module B to an output of module A such that Terraform’s dependency management handles this automagically.

Hi,

The dependencies should be in your terragrunt.hcl. The dependencies main purpose is to guarantee correct execution order when you’re applying or destroying infrastructure with the *-all -commands.

Normally your live only contains the terragrunt.hcl for passing variables into your infrastructure-modules. The modules is where you use the outputs and the terraform dependency hierarchy - which is a bit different from the terragrunt.hcl dependency declaration.

Hope this clarifies the issue!

/Petri