Code Monkey home page Code Monkey logo

Comments (10)

brikis98 avatar brikis98 commented on May 18, 2024 1

We are unlikely to implement this, as we've seen that people use Terragrunt and their VCS in a variety of ways. Closing.

from terragrunt.

DrewEaster avatar DrewEaster commented on May 18, 2024

This proposal wouldn't solve the 2nd problem described above:

You forget to run git commit and git push after running terragrunt apply, so even if your other teammates remember to run git pull, they will end up applying out-of-date templates.

What about introducing an additional wrapper step if the actual Terraform command is apply that does a git commit and a git push? Trying to play out in my mind what the downsides of this would be...

from terragrunt.

brikis98 avatar brikis98 commented on May 18, 2024

This proposal wouldn't solve the 2nd problem described above:

This would be handled by step 3:

  1. Check if you have any uncommitted or unpushed files in master, and if you do, exit with an error.

I suppose that step could also do the git commit and git push for you, but that seems riskier, as every team has its own process for that (e.g. submit a PR).

from terragrunt.

DrewEaster avatar DrewEaster commented on May 18, 2024

Whoops, my attention to detail had a fail moment there :-)

from terragrunt.

brikis98 avatar brikis98 commented on May 18, 2024

Heh, no worries.

Do you think this approach would solve the issues with out of date .tf files?

from terragrunt.

DrewEaster avatar DrewEaster commented on May 18, 2024

I guess there's still some issues:

  1. Forcing changes to be pushed probably only makes sense if the command is apply? Why would one expect changes to be pushed unless an attempt was being made to actual mutate infrastructure?
  1. It's feasible that the Terraform apply command might fail, in which case changes have been pushed to git and infrastructure not mutated.

  2. If there's a merge conflict when pulling master, again, there's going to be a window during which infrastructure is not mutated to reflect the changes that have been pushed to git.

Not sure a simple command line tool would ever be able to close every gap, though.

from terragrunt.

brikis98 avatar brikis98 commented on May 18, 2024

Forcing changes to be pushed probably only makes sense if the command is apply?

True. I updated the description to make that more clear.

It's feasible that the Terraform apply command might fail, in which case changes have been pushed to git and infrastructure not mutated.

True, but I'd argue those changes should still be in Git in that case, as they likely partially applied, and that code is still the best representation of your infrastructure that you have.

If there's a merge conflict when pulling master, again, there's going to be a window during which infrastructure is not mutated to reflect the changes that have been pushed to git.

If git pull fails, then terragrunt apply will release the lock and exit without applying any changes. Once you fix the conflict and commit and push, then you can run it again.

Not sure a simple command line tool would ever be able to close every gap, though.

No, but it seems like we can get 95% of what we need here.

from terragrunt.

tamsky avatar tamsky commented on May 18, 2024

What if I don't use git ?

from terragrunt.

brikis98 avatar brikis98 commented on May 18, 2024

@tamsky Support for other version control systems could be added too. That's why there is a backend setting in the proposal above.

from terragrunt.

tamsky avatar tamsky commented on May 18, 2024

Just sayin,
We do everything you propose (checking for upstream and local unpushed changes), in our Makefile.

from terragrunt.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.