The more I work as a Dev Ops / Platform Eng, the more I fight a single anti-pattern.

For your future self :
1. Use #terragrunt and not only #terraform / #opentofu ,
2. Centralize you #tf code in different modules in a single repository and have #tg use them ,
3. That one goes without saying but here it is : DRY your code using locals !

I'm tired of removing hundred lines of #IaC code just for the sake of maintainability.

Two more while I'm at it.

4. Use `basename(get_terragrunt_dir())` when you need your code to be generic depending on the path it lives in.
5. Use `read_terragrunt_config(find_in_parent_folders([...]))` to fetch remote locals.

Ok, one more but it goes with 2. : DO NOT configure your providers in the #terraform / #opentofu code. You're shooting yourself in the foot here, let #terragrunt handle this dynamically.