Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add plugin for OpenTofu #12285

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
53 changes: 53 additions & 0 deletions plugins/opentofu/README.md
@@ -0,0 +1,53 @@
# 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

- [OpenTofu](https://opentofu.org/)

## Aliases

| Alias | Command |
| ----- | --------------- |
| `tt` | `tofu` |
| `tta` | `tofu apply` |
| `ttc` | `tofu console` |
| `ttd` | `tofu destroy` |
| `ttf` | `tofu fmt` |
| `tti` | `tofu init` |
| `tto` | `tofu output` |
| `ttp` | `tofu plan` |
| `ttv` | `tofu validate` |
| `tts` | `tofu state` |
| `ttsh`| `tofu show` |
| `ttr` | `tofu refresh` |
| `ttt` | `tofu test` |
| `ttws`| `tofu workspace`|


## Prompt function

You can add the current OpenTofu workspace in your prompt by adding `$(tofu_prompt_info)`,
`$(tofu_version_prompt_info)` to your `PROMPT` or `RPROMPT` variable.

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

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

```sh
ZSH_THEME_TOFU_PROMPT_PREFIX="%{$fg[white]%}"
ZSH_THEME_TOFU_PROMPT_SUFFIX="%{$reset_color%}"
ZSH_THEME_TOFU_VERSION_PROMPT_PREFIX="%{$fg[white]%}"
ZSH_THEME_TOFU_VERSION_PROMPT_SUFFIX="%{$reset_color%}"
```