Comments (6)
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.
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.
I would expand on that and would like to see the following path for version identification stopping at the first match
- look for required_version in the .TF files
- look for .tfswitch.toml in current work directory
- look for .tfswitch.toml in users home directory
from terraform-switcher.
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.
will release soon with : #113
from terraform-switcher.
.tfswitch.toml
from the local directory should have a higher priority than ~/.tfswitch.toml
.
from terraform-switcher.
Related Issues (20)
- Error in v1.10 parsing version HOT 3
- Any content in terragrunt.hcl other than "terraform_version_constraint" causes tfswitch to error HOT 7
- We are facing the issue with the latest version(v1.1.0) of tfswitcher HOT 2
- v1.1.0 does not parse tf version constraint correctly HOT 5
- install.sh does not support non v-prefixed tags HOT 3
- Terraform `1.8.2` ships additional file within tarball
- Reading automatically from ~/.tfswitch.toml is broken HOT 17
- `log-level` TOML config doesn't work HOT 1
- How do I turn off logging? HOT 8
- tfswitch ignored -b argument HOT 5
- v1.1.1 ignoring `required_version` HOT 1
- Install script issue HOT 3
- Move away from golang openpgp HOT 2
- Version: v1.1.1 no longer reads terraform required_version anymore HOT 29
- tfswitch -v should not apply anything - it should only print the tfswitch version HOT 4
- terraform file extraction does not work under windows
- Standardise logic for failing/warning when an error occurs during terraform version detection HOT 4
- [Feature request] Disable color logs when not a terminal HOT 2
- Add additional debug logs when determining version from various sources
- Re-add support for environment variable that is a default version
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from terraform-switcher.