Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ASleepyCat/tfswitcher
Terraform and OpenTofu version switcher written in Rust
https://github.com/ASleepyCat/tfswitcher
Last synced: 7 days ago
JSON representation
Terraform and OpenTofu version switcher written in Rust
- Host: GitHub
- URL: https://github.com/ASleepyCat/tfswitcher
- Owner: ASleepyCat
- License: mit
- Created: 2023-04-25T08:08:06.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-10-07T05:40:47.000Z (about 1 month ago)
- Last Synced: 2024-10-07T21:39:54.609Z (about 1 month ago)
- Language: Rust
- Homepage:
- Size: 427 KB
- Stars: 3
- Watchers: 1
- Forks: 1
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-opentofu - tfswitcher - Terraform and OpenTofu version switcher written in Rust. (Tools / Environment managers)
README
# tfswitcher
Terraform and OpenTofu version switcher written in Rust.
## Installation
### Homebrew
To install via Homebrew, run:
```bash
brew install asleepycat/tap/tfswitcher
```This will build from source.
### Cargo
To install with `cargo`, run:
```bash
cargo install tfswitcher
```There are also prebuilt binaries available with each release for Linux, macOS and Windows.
## Usage
To see available flags and arguments, run `tfswitcher -h` or `tfswitcher --help`.
You can also use a configuration file to automatically set certain flags or arguments. Simply place a file
called `.tfswitch.toml` either in your current working directory or in your `$HOME` directory.```toml
bin = "$HOME/.local/bin/terraform"
list_all = false
opentofu = false
force_remove = false
silent = false
verbose = false
version = "1.0.0"
```## Shell Completions
`tfswitcher` can generate tab-completion scripts for your desired shell. To see which shells are supported, see
the `--help` text.For example, for Bash:
```bash
tfswitcher -c bash >> ~/.local/share/bash-completion/completions/tfswitcher
```Alternatively, you can source the tab-completion script inside your shell's start up script:
```bash
echo "source <(tfswitcher -c bash)" >> ~/.bashrc
```## Caveats
This has not been tested on Windows or macOS, so YMMV.
## Where's `v0.1.0`?
`v0.1.0` used FFI with Cgo in order to use
HashiCorp's [`terraform-config-inspect`](https://github.com/hashicorp/terraform-config-inspect) library.
This was inadvertently published as the Windows and macOS builds were broken and is yanked.`v0.2.0` replaced the Go library with a partially-reimplemented Rust library to eliminate FFI and makes building for
Windows and macOS a lot less painful.