Skip to content

Commit

Permalink
Merge pull request #5 from Ant0wan/master
Browse files Browse the repository at this point in the history
Master
  • Loading branch information
Ant0wan authored Apr 19, 2023
2 parents ae6c4e8 + 4a3e914 commit 7671f5f
Show file tree
Hide file tree
Showing 8 changed files with 52 additions and 8 deletions.
2 changes: 1 addition & 1 deletion config/bashrc.d/terraform
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,5 @@ alias tv='terraform validate'
alias twl='terraform workspace list'
alias tws='terraform workspace select'

complete -d -f -C ~/.terraform.versions/terraform_1.2.4 terraform
complete -d -f -C /usr/local/bin/terraform terraform

1 change: 1 addition & 0 deletions tools/install-cmd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ set -o pipefail

BINS=('shellcheck' 'hadolint' 'jq' 'fzf')
sudo dnf install ${BINS[@]} -yq
fzf --multi --bind 'right:select-all' --bind 'left:deselect-all' --bind 'space:toggle+down' --marker='x' --height 40% --layout reverse --info inline --border
16 changes: 10 additions & 6 deletions tools/install-terraform.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
#!/usr/bin/env bash
set -o errexit
set -o errtrace
set -o pipefail

sudo dnf install -y dnf-plugins-core
sudo dnf config-manager --add-repo https://rpm.releases.hashicorp.com/fedora/hashicorp.repo
sudo dnf -y install terraform
VERSION='1.4.5'
BIN="terraform_${VERSION}_linux_amd64.zip"

touch ~/.bashrc
sudo mv /usr/bin/terraform /usr/local/bin/terraform
terraform -install-autocomplete
curl "https://releases.hashicorp.com/terraform/$VERSION/$BIN" -o "$BIN"
unzip "$BIN"
sudo install terraform /usr/local/bin/
rm -rf "$BIN" terraform

mkdir -p "$HOME/.bashrc.d/"
pushd "$(git rev-parse --show-toplevel)" || exit 1
cp config/bashrc.d/terraform "$HOME"/.bashrc.d/terraform
popd || exit 1
Expand Down
7 changes: 7 additions & 0 deletions tools/install-tfswitch.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env bash
set -o errexit
set -o errtrace
set -o pipefail

curl -L https://raw.githubusercontent.com/warrensbox/terraform-switcher/release/install.sh | sudo bash

1 change: 0 additions & 1 deletion tools/install.sh

This file was deleted.

7 changes: 7 additions & 0 deletions tools/my-tfswitch/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions tools/my-tfswitch/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[package]
name = "my-tfswitch"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
18 changes: 18 additions & 0 deletions tools/my-tfswitch/src/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
use std::env;
use std::io::Result;
use std::process::Command;

fn main() -> Result<()> {
let args: Vec<String> = env::args().skip(1).collect();

let _ = Command::new("/usr/local/bin/tfswitch")
.output()
.expect("failed to get Terraform binary");

let _status = Command::new("terraform")
.args(args)
.status()
.expect("failed to get Terraform binary");

Ok(())
}

0 comments on commit 7671f5f

Please sign in to comment.