Hacker News new | past | comments | ask | show | jobs | submit login

This is frighteningly complex and I would not recommend this for reliability concerns. Terraform makes it quite difficult to maintain a structure like this, mostly due to the inability to interpolate module versions.

I highly recommend anyone using terraform start with a mono repo. Still use modules and then spread out your components but definitely don't try to split them up in separate repos because keeping the version graph together will become a real pain and is easy to mismanage.

From there, ensure any logical components have their own separate lock and state file. If you don't do this, it is going to be a game of roulette to know when this resource was last run and what might change if you roll it out. It is easy to build your own directed graph between components using data sources. These allow you to have component B read component A's state file to get the outputs it needs.

All in all, I've found most of the documentation and "best practice" in the terraform community promoting dangerous practices. I talk more about these practices in this podcast[0]

[0]: https://packetpushers.net/podcast/full-stack-journey-027-und...




Having worked with Terraform for 3 years, I totally agree!

Hashicorp should put more money into promoting "healthy" terraform tutorials based on real world usage (maybe split for small/medium/large orgs)

My first setup was split into 10-15 repos and it was an nightmare...

Now I have a mono-repo (and some GitlabCI magic to handle different projects) + terragrunt and it so much more stable than my first setup! As with everything, start simple, only change if you hit a wall!


Do you mind sharing your strategy for module versioning in a mono-repo? anything you encountered that really didn't work?


I agree as well. Hell, even the vscode official extension doesn't support multi-folders workspaces.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: