summaryrefslogtreecommitdiff
path: root/plugins/opentofu/README.md
blob: 45b98c3c93edfe3fb9d8e7ae0b29133759b8c3d2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# 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`                 |
| `ttaa` | `tofu apply -auto-approve`   |
| `ttc`  | `tofu console`               |
| `ttd`  | `tofu destroy`               |
| `ttd!` | `tofu destroy -auto-approve` |
| `ttf`  | `tofu fmt`                   |
| `ttfr` | `tofu fmt -recursive`        |
| `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 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%}"
```