Leonardo Tavares
08/06/2024, 11:47 AMKhaled Ezzughayyar
08/06/2024, 11:51 AMLeonardo Tavares
08/06/2024, 11:55 AMThameez
08/06/2024, 1:22 PMLeonardo Tavares
08/06/2024, 1:52 PMref=v2.0
and if we update from 2.0.1
to 2.0.2
the update is propagated to those who use ref=v2.0
instead of ref=v2.0.1
.
Same with using major as a ref, etc...Nicholas Capo
08/06/2024, 2:01 PMgit
In a monorepo:
⢠How do I get the latest version of everything?: git pull
⢠How do I make sure that my feature branch is up to date with all my (internal) dependencies?: git merge origin/main
⢠How do I browse all the code that is in production?: git checkout main
⢠What changed in this commit/feature branch/etc?: git diff
Since you have all of this in one repo, any time you make a change you can to fix all the callers, and that change is atomic (for everyone else) because it can all be in one commit (or one merge).
Having good CI also helps to find any callers that you forgot about or didn't even know about.
I would highly recommend against any "fancy"/"clever" versioning, just use git
. đKhaled Ezzughayyar
08/06/2024, 2:53 PMLeonardo Tavares
08/06/2024, 3:13 PMNicholas Capo
08/06/2024, 3:21 PMEvery change to my module would also mean a change to all other codes that refer to it? What if I don't want that?If necessary (specifically a breaking change) then yes. But deferring those updates until later (never?) makes them even harder to do later. If every change to your module is immediately used by all the plans, then finding/reporting bugs becomes easier, and there are never any old versions to maintain, only
main
.
Doesn't this require me to remember to update these everytime?If you use
git
as the dependency manager then locking the versions will make things extra hard for exactly the reason your mention.
I can make breaking changes that I don't really want to deal with right nowI would avoid adding the tech debt đ Whats the point of making a change if no one will use it? Does software without a user really exist? Can you run
terraform plan
in CI (or locally)?
That will give you confidence in your change being correct (for all users).Nicholas Capo
08/06/2024, 3:22 PMmain
Louis McCormack
08/06/2024, 4:44 PMmy-module-1.0.1
.
⢠you can then refer to that tag specifically when consuming the module.
There is a downside to this method though: every terraform init
will pull the entire Git repo and store it in a local .terraform
directory. Although I think that may be unavoidable if you are using a single repo, either way.
The 'proper' way to do this, if you want to avoid CD-ing the code on every commit, is to use a Terraform registry to register the modules.bincyber
08/06/2024, 7:13 PMThameez
08/07/2024, 7:09 AMbut in this case I couldn't use semver, right?Not if your commits have a semver tag attached, The response by Louis above encapsulates it perfectly (including the downside)
Wawad
08/07/2024, 3:41 PMLeonardo Tavares
08/08/2024, 9:20 AMNicholas Capo
08/08/2024, 5:51 PMHow would you deal with, for example, a refactoring that works on 99% of the code, but on one specific env it breaks naming convention and that leads to resources being recreated?Yeah, I admit, that's not an easy problem to solve đ