Back to Ohmyzsh

OpenTofu plugin

plugins/opentofu/README.md

latest1.9 KB
Original Source

OpenTofu plugin

Plugin for OpenTofu, a fork of Terraform that is open-source, community-driven, and managed by the Linux Foundation. It adds completion for tofu command, as well as aliases and a prompt function.

To use it, add opentofu to the plugins array of your ~/.zshrc file:

shell
plugins=(... opentofu)

Requirements

Aliases

AliasCommand
tttofu
ttatofu apply
tta!tofu apply -auto-approve
ttctofu console
ttdtofu destroy
ttd!tofu destroy -auto-approve
ttftofu fmt
ttfrtofu fmt -recursive
ttitofu init
ttotofu output
ttptofu plan
ttvtofu validate
ttstofu state
ttshtofu show
ttrtofu refresh
ttttofu test
ttwstofu workspace

Prompt functions

  • tofu_prompt_info: shows the current workspace when in an OpenTofu project directory.

  • tofu_version_prompt_info: shows the current version of the tofu command.

To use them, add them to a PROMPT variable in your theme or .zshrc file:

sh
PROMPT='$(tofu_prompt_info)'
RPROMPT='$(tofu_version_prompt_info)'

You can also specify the PREFIX and SUFFIX strings for both functions, with the following variables:

sh
# for tofu_prompt_info
ZSH_THEME_TOFU_PROMPT_PREFIX="%{$fg[white]%}"
ZSH_THEME_TOFU_PROMPT_SUFFIX="%{$reset_color%}"
# for tofu_version_prompt_info
ZSH_THEME_TOFU_VERSION_PROMPT_PREFIX="%{$fg[white]%}"
ZSH_THEME_TOFU_VERSION_PROMPT_SUFFIX="%{$reset_color%}"