Terragrunt: Terragrunt graph-all?

Created on 16 Mar 2020  ยท  2Comments  ยท  Source: gruntwork-io/terragrunt

Hello,

Im trying to create a terraform graph of my entire infrastructure. not just the individual modules.

my project structure is as follows:

myproject
โ”œโ”€โ”€ production
โ”‚ย ย  โ”œโ”€โ”€ nic-vm1
โ”‚ย ย  โ”‚ย ย  โ””โ”€โ”€ terragrunt.hcl
โ”‚ย ย  โ”œโ”€โ”€ nic-vm2
โ”‚ย ย  โ”‚ย ย  โ””โ”€โ”€ terragrunt.hcl
โ”‚ย ย  โ”œโ”€โ”€ subnet-vm1
โ”‚ย ย  โ”‚ย ย  โ””โ”€โ”€ terragrunt.hcl
โ”‚ย ย  โ”œโ”€โ”€ subnet-vm2
โ”‚ย ย  โ”‚ย ย  โ””โ”€โ”€ terragrunt.hcl
โ”‚ย ย  โ”œโ”€โ”€ aks-prod
โ”‚ย ย  โ”‚ย ย  โ””โ”€โ”€ terragrunt.hcl
โ”‚   โ””โ”€โ”€โ”€ terragrunt.hcl
โ””โ”€โ”€ modules
    โ”œโ”€โ”€ azurerm_nic
    โ”‚ย ย  โ”œโ”€โ”€ main.tf
    โ”‚ย ย  โ”œโ”€โ”€ outputs.tf
    โ”‚ย ย  โ””โ”€โ”€ vars.tf
    โ”œโ”€โ”€ azurerm_aks
    โ”‚ย ย  โ”œโ”€โ”€ main.tf
    โ”‚ย ย  โ”œโ”€โ”€ outputs.tf
    โ”‚ย ย  โ””โ”€โ”€ vars.tf
    โ””โ”€โ”€ azurerm_vm
     ย ย  โ”œโ”€โ”€ main.tf
     ย ย  โ”œโ”€โ”€ outputs.tf
     ย ย  โ””โ”€โ”€ vars.tf

If I got into each production item (vm1, vm2 etc..) i can run terragrunt graph and use the output and it will automatically include any dependencies for that item.

When i build my infrastructure, i simply run terragrunt apply-all from the production directory, which will use the top level terragrunt.hcl.

What I dont know how to do, it get a terragrunt graph-all type output which shows my entire infrastructure in one command. Or even a way of concatenating the outputs from the individual terragrunt graphs would work.

This modular layout that im using seems very popular, so im suprised nobody has asked it before. unless there is something obvious about how to do it that im missing.

```

enhancement help wanted

Most helpful comment

I've personally found the graph command to not be too useful for large infrastructure, as the graph gets too big and intertwined to read... But if you can find a way to support this, a PR is welcome. See also #492.

All 2 comments

I've personally found the graph command to not be too useful for large infrastructure, as the graph gets too big and intertwined to read... But if you can find a way to support this, a PR is welcome. See also #492.

I just ran the following: https://github.com/gruntwork-io/terragrunt/pull/1117
Which looked like this:

terragrunt graph-dependencies | dot -Tsvg > graph.svg

And it does the job!
The formatting isnt ideal, but i can play around with that myself.

Was this page helpful?
0 / 5 - 0 ratings