I don’t usually post, but thought I’d share.
I rebuilt my homelab with OpenTofu. Now my entire setup, from containers to networking, lives in a Git repo.
The best part is that new services get published automatically. I just set a flag in the code, and it builds the Caddy proxy or Cloudflare tunnel for me. No more manual config editing.
Here’s my quick write-up on it: https://yuris.dev/blog/homelab-opentofu
And the code is all public if you want to see how it works: https://github.com/yurisasc/homelab
Hope this is interesting to someone. Happy to answer any questions if you have them. Curious to hear if anyone else has gone down this particular rabbit hole with IaC for their Docker stack.
Finally found someone who uses OpenTofu for Docker too. I saw many opinions and thinking that dropping Compose for OpenTofu/Terraform is silly, because Compose is “more native”. I use OpenTofu for Docker too, but I structured code in other way, I have a module that mimics compose in some way, but is simpler for me to use. I published module here: https://codeberg.org/cichy1173/cichyform
I do not published my IaC, but I can show how code looks like for service:
I also created an Forgejo Action to run plan on stacks with this module to check if there is a new image under the tag
:latest
. Oh, and also I manage Adguard Home using OpenTofu, it is very powerful: https://codeberg.org/cichy1173/adguard-home-cm-repository