Code Monkey home page Code Monkey logo

zsh-terraform's Introduction

GitHub pre-commit Release

zsh-terraform

zsh plugin for Terraform, a tool from Hashicorp for managing infrastructure safely and efficiently.

This plugins extends original oh-my-zsh plugin with aliases, functions and autocompletion.

It will also install and load some useful tools :

Table of content

This documentation section is generated automatically

Requirements

You can install, manage different terraform versions using terraform for example

Usage

Bundle zsh-terraform in your .zshrc

antigen bundle ptavares/zsh-terraform

Load zsh-terraform as a plugin in your .zshrc

zplug "ptavares/zsh-terraform"

Include the load command in your .zshrc

zget load ptavares/zsh-terraform

Clone zsh-terraform into your custom plugins repo and load as a plugin in your .zshrc

git clone https://github.com/ptavares/zsh-terraform.git ~/.oh-my-zsh/custom/plugins/zsh-terraform
plugins+=(zsh-terraform)

Keep in mind that plugins need to be added before oh-my-zsh.sh is sourced.

  • Manually

Clone this repository somewhere (~/.zsh-terraform for example) and source it in your .zshrc

git clone https://github.com/ptavares/zsh-terraform ~/.zsh-terraform
source ~/.zsh-terraform/zsh-terraform.plugin.zsh

Aliases

Alias Command
tf terraform
tff tf fmt
tfv tf validate
tfi tf init
tfp tf plan
tfa tf apply
tfd tf destroy
tfo tf output
tfr tf refresh
tfs tf show
tfw tf workspace
tffr tff -recursive
tfip tfi & tfp
tfia tfi & tfa
tfid tfi & tfd
tfa! tfa -auto-approve
tfia! tfi && tfa!
tfd! tfd -auto-approve
tfid! tfi && tfd!
tfversion tf version

Function

tfws [workspace_name]

Will execute command :

tfw select [workspace_name] || tfw new [workspace_name]

Prompt function

You can add the current Terraform workspace in your prompt by adding $(tf_prompt_info) to your PROMPT or RPROMPT variable.

RPROMPT` | `$(tf_prompt_info)'

You can also specify the PREFIX and SUFFIX for the workspace with the following variables:

ZSH_THEME_TF_PROMPT_PREFIX="%{$fg[white]%}"
ZSH_THEME_TF_PROMPT_SUFFIX="%{$reset_color%}"

Updating Terraform tools

The plugin comes with a zsh function to update all Terraform tools manually

# From zsh shell
update_zsh_terraform

License

MIT

zsh-terraform's People

Contributors

ptavares avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Forkers

icyleaf andyfore

zsh-terraform's Issues

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.