Giter Site home page Giter Site logo

Comments (6)

warrensbox avatar warrensbox commented on June 24, 2024 1

Let's say you have multiple projects with different terraform versions for each project, you can specify each terraform version in it's local/current directory.

.
├── terraform-project-1
│   └── version-tf-11.13
├── terraform-project-2
│   └── version-tf-11.14
└── terraform-project-3
    └── version-tf-12.24

If you want ~/.tfswitch.toml in the home directory ~, how do you manage the different versions of terraform for each project?
Are you only using one terraform version for all your project(s)?
@odbaeu @dcl can you please provide more information?

from terraform-switcher.

odbaeu avatar odbaeu commented on June 24, 2024 1

Thank you so much for your quick reaction!

I try to keep most of my terraform projects on one version. That's why I think this is a good feature request. But I absolutely agree that it is best practice to have one .tfswitch.toml in each terraform project. This helps other team members to use the correct terraform version.

But back to the feature request: Let’s say I have the following structure:

~/.tfswitch.toml
~/projects/A
~/projects/B
~/projects/B/.tfswitch.toml
~/projects/C

In case the project has a .tfswitch.toml in the project’s directory, this should be picked. If it's not there, tfswitch would look for ~/.tfswitch.toml. In this case ~/.tfswitch.toml would be valid for project A and C.

This also means that ~/.tfswitch.toml is the default configuration and I can overwrite it.

from terraform-switcher.

jurrehart avatar jurrehart commented on June 24, 2024 1

I would expand on that and would like to see the following path for version identification stopping at the first match

  1. look for required_version in the .TF files
  2. look for .tfswitch.toml in current work directory
  3. look for .tfswitch.toml in users home directory

from terraform-switcher.

fdamstra avatar fdamstra commented on June 24, 2024 1

I would add that if you're doing hierarchical modules, it would be really nice for it to search parent directories. My company's code is organized in terragrunt fashion, like:

~/projects/A
~/projects/A/prod
~/projects/A/prod/vpcs
~/projects/A/prod/instances
~/projects/A/test/vpcs
~/projects/A/test/instances

And then repeat for project B and so forth. It would be extremely useful to look for the .tfswitch.toml in the present directory, then work up the parent directories until either we're in ~ or /.

This would let me use a new version of tf in test while retaining the known-good version in prod, but not have to have dozens (no exageration) of hidden .tfswitch.toml files lying around.

from terraform-switcher.

warrensbox avatar warrensbox commented on June 24, 2024 1

will release soon with : #113

from terraform-switcher.

odbaeu avatar odbaeu commented on June 24, 2024

.tfswitch.toml from the local directory should have a higher priority than ~/.tfswitch.toml.

from terraform-switcher.

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.