-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
80 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
MIT License | ||
|
||
Copyright (c) 2020-2023 Piotr Roszatycki <[email protected]> | ||
Copyright (c) 2020-2024 Piotr Roszatycki <[email protected]> | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy of | ||
this software and associated documentation files (the "Software"), to deal in | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,21 +5,21 @@ | |
[![Release](https://github.com/dex4er/tf/actions/workflows/release.yaml/badge.svg)](https://github.com/dex4er/tf/actions/workflows/release.yaml) | ||
[![Trunk Check](https://github.com/dex4er/tf/actions/workflows/trunk.yaml/badge.svg)](https://github.com/dex4er/tf/actions/workflows/trunk.yaml) | ||
|
||
Less verbose and more shell friendly Terraform. | ||
Less verbose and more shell-friendly Terraform. | ||
|
||
| Better this: | Than this: | | ||
| ---------------------------------------------------------- | ---------------------------------------------------------------------- | | ||
| [![tf apply -compact](assets/tf-small.gif)](assets/tf.gif) | [![terraform apply](assets/terraform-small.gif)](assets/terraform.gif) | | ||
|
||
The original Terraform is abusively oververbosed. The `tf` wrapper makes | ||
Terraform more CLI friendly: | ||
Terraform more CLI-friendly: | ||
|
||
- removes unecessary output | ||
- removes unnecessary output | ||
- adds own colored progress indicator | ||
- provides extra compact mode | ||
- allows to use multiple arguments when original command don't support it | ||
- adds automatically quotes for indexed resources (xargs friendly) | ||
- generates log file when `TF_OUTPUT_PATH` environment variable is used | ||
- provides an extra compact mode | ||
- allows to use of multiple arguments when original command doesn't support it | ||
- adds automatically quotes for indexed resources (`xargs` friendly) | ||
- generates a log file when `TF_OUTPUT_PATH` environment variable is used | ||
|
||
## Install | ||
|
||
|
@@ -45,32 +45,32 @@ mise plugins install tf https://github.com/dex4er/asdf-tf.git | |
mise use -g tf@latest | ||
``` | ||
|
||
### MacOS | ||
### Homebrew | ||
|
||
MacOS forbids running the code directly downloaded with the browser from an | ||
unknown source. In that case, the file must downloaded in the terminal, not a | ||
GUI or the downloaded binary must be recreated, ie.: | ||
Install with [homebrew](https://brew.sh/): | ||
|
||
```sh | ||
cat tf > tf_unquarantined | ||
rm -f tf | ||
mv -f tf_unquarantined tf | ||
chmod +x tf | ||
brew tap dex4er/tap | ||
brew install tf | ||
``` | ||
|
||
You can download the application with ie. `curl` or `asdf` instead. | ||
|
||
### Zsh | ||
|
||
With Zsh `noglob` should be used to prevent errors when indexed paramerers are | ||
arguments for `tf` command. | ||
With Zsh `noglob` should be used to prevent errors when indexed parameters | ||
are arguments for `tf` command. | ||
|
||
Add to `~/.zshenv`: | ||
|
||
```sh | ||
alias tf='noglob tf' | ||
``` | ||
|
||
You can use re-use Oh My Zsh plugin dedicated to the original Terraform: | ||
|
||
```sh | ||
compdef _terraform tf | ||
``` | ||
|
||
## Usage | ||
|
||
```sh | ||
|
@@ -125,15 +125,17 @@ messages about progress and shows single dot or character for each line, | |
to original messages (default if `TF_IN_AUTOMATION=1`), `-no-outputs` hides | ||
outputs (default, `-no-outputs=false` shows it again). | ||
|
||
The command accepts resource name as an argument without `-target=` option. If | ||
argument misses quotes inside square brackets then they will be added. | ||
The command accepts the resource name as an argument without `-target=` | ||
option. If the argument misses quotes inside square brackets then they will | ||
be added. | ||
|
||
The command will log to the file named in `TF_OUTPUT_PATH` environment | ||
variable. The file name is resolved with `strftime`'s `%` sequences. | ||
|
||
The variable `TF_PLAN_FORMAT` switches the default format for plan (compact, | ||
short, full). The variable `TF_PROGRESS_FORMAT` switches the default format | ||
for progress indicator (counters, fan, dots, verbose, verbatim). | ||
The variable `TF_PLAN_FORMAT` switches the default format for the plan | ||
(compact, short, full). The variable `TF_PROGRESS_FORMAT` switches the | ||
default format for the progress indicator (counters, fan, dots, verbose, | ||
verbatim). | ||
|
||
### `tf destroy` | ||
|
||
|
@@ -147,23 +149,24 @@ it will hide a plan for data sources (`data.xxx will be read during apply` | |
blocks) from the `-short` and `-compact` mode output. | ||
|
||
Additional options can be used: `-counters` shows counters with processed | ||
resources, `-compact` skips the content of the resources, `-short` removes | ||
unecessary lines (default), `-full` keeps original manifest, `-fan` hides | ||
messages about progress and shows short indicator (default), `-dots` hides | ||
messages about progress and shows single dot or character for each line, | ||
`-verbatim` keeps original messages about progress, `-verbose` adds counters | ||
to original messages (default if `TF_IN_AUTOMATION=1`), `-no-outputs` hides | ||
outputs (default, `-no-outputs=false` shows it again). | ||
resources, `-compact` skips the content of the resources, `-`short`removes | ||
unnecessary lines (default),`-full`keeps original manifest,`-fan`hides | ||
messages about progress and shows short indicator (default),`-dots`hides | ||
messages about progress and shows single dot or character for each line,`-verbatim`keeps original messages about progress,`-verbose`adds counters | ||
to original messages (default if`TF_IN_AUTOMATION=1`), `-no-outputs`hides | ||
outputs (default,`-no-outputs=false` shows it again). | ||
|
||
The command accepts resource name as an argument without `-target=` option. If | ||
argument misses quotes inside square brackets then they will be added. | ||
The command accepts the resource name as an argument without `-target=` | ||
option. If the argument misses quotes inside square brackets then they will | ||
be added. | ||
|
||
The command will log to the file named in `TF_OUTPUT_PATH` environment | ||
variable. The file name is resolved with `strftime`'s `%` sequences. | ||
|
||
The variable `TF_PLAN_FORMAT` switches the default format for plan (compact, | ||
short, full). The variable `TF_PROGRESS_FORMAT` switches the default format | ||
for progress indicator (counters, fan, dots, verbose, verbatim). | ||
The variable `TF_PLAN_FORMAT` switches the default format for the plan | ||
(compact, short, full). The variable `TF_PROGRESS_FORMAT` switches the | ||
default format for the progress indicator (counters, fan, dots, verbose, | ||
verbatim). | ||
|
||
### `tf import` | ||
|
||
|
@@ -173,7 +176,7 @@ If the first argument misses quotes inside square brackets then they will be | |
added. | ||
|
||
The command appends the third argument and more to the second with a space as | ||
separator. | ||
the separator. | ||
|
||
The `tf show` for this resource is run after import unless additional option | ||
`-no-show` has been used. | ||
|
@@ -194,71 +197,74 @@ applications with unrecognized signature. | |
|
||
The same as `terraform state list` with less verbose output and ANSI stripped. | ||
|
||
If argument misses quotes inside square brackets then they will be added. | ||
If the argument misses quotes inside square brackets then they will be added. | ||
|
||
### `tf mv` | ||
|
||
The same as `terraform state mv` with less verbose output. | ||
|
||
If argument misses quotes inside square brackets then they will be added. | ||
If the argument misses quotes inside square brackets then they will be added. | ||
|
||
### `tf plan` | ||
|
||
The same as `terraform plan` with less verbose output. | ||
|
||
Instead of Reading... messages it will show a short progress indicator. | ||
|
||
It will skip `(known after apply)` lines from the `-short` mode output. Also | ||
It will skip `(known after apply)` lines from the `-short` mode output. Also, | ||
it will hide a plan for data sources (`data.xxx will be read during apply` | ||
blocks) from the `-short` and `-compact` mode output. | ||
|
||
Additional options can be used: `-counters` shows counters with processed | ||
resources, `-compact` skips the content of the resources, `-short` removes | ||
unecessary lines (default), `-full` keeps original manifest, `-fan` hides | ||
unnecessary lines (default), `-full` keeps original manifest, `-fan` hides | ||
messages about progress and shows short indicator (default), `-dots` hides | ||
messages about progress and shows single dot or character for each line, | ||
`-verbatim` keeps original messages about progress, `-verbose` adds counters | ||
to original messages (default if `TF_IN_AUTOMATION=1`). | ||
|
||
The command accepts resource name as an argument without `-target=` option. If | ||
argument misses quotes inside square brackets then they will be added. | ||
The command accepts the resource name as an argument without `-target=` | ||
option. If the argument misses quotes inside square brackets then they will | ||
be added. | ||
|
||
The command will log to the file named in `TF_OUTPUT_PATH` environment | ||
variable. The file name is resolved with `strftime`'s `%` sequences. | ||
|
||
The variable `TF_PLAN_FORMAT` switches the default format for plan (compact, | ||
short, full). The variable `TF_PROGRESS_FORMAT` switches the default format | ||
for progress indicator (counters, fan, dots, verbose, verbatim). | ||
The variable `TF_PLAN_FORMAT` switches the default format for the plan | ||
(compact, short, full). The variable `TF_PROGRESS_FORMAT` switches the | ||
default format for the progress indicator (counters, fan, dots, verbose, | ||
verbatim). | ||
|
||
### `tf refresh` | ||
|
||
The same as `terraform refresh` with less verbose output. | ||
|
||
Additional options can be used: `-counters` shows counters with processed | ||
resources, `-compact` skips the content of the resources, `-short` removes | ||
unecessary lines (default), `-full` keeps original manifest, `-fan` hides | ||
unnecessary lines (default), `-full` keeps original manifest, `-fan` hides | ||
messages about progress and shows short indicator (default), `-dots` hides | ||
messages about progress and shows single dot or character for each line, | ||
`-verbatim` keeps original messages about progress, `-verbose` adds counters | ||
to original messages (default if `TF_IN_AUTOMATION=1`), `-no-outputs` hides | ||
outputs (default, `-no-outputs=false` shows it again). | ||
|
||
The command accepts resource name as an argument without `-target=` option. If | ||
argument misses quotes inside square brackets then they will be added. | ||
The command accepts resource name as an argument without `-target=` option. | ||
If the argument misses quotes inside square brackets then they will be added. | ||
|
||
The command will log to the file named in `TF_OUTPUT_PATH` environment | ||
variable. The file name is resolved with `strftime`'s `%` sequences. | ||
|
||
The variable `TF_PLAN_FORMAT` switches the default format for plan (compact, | ||
short, full). The variable `TF_PROGRESS_FORMAT` switches the default format | ||
for progress indicator (counters, fan, dots, verbose, verbatim). | ||
The variable `TF_PLAN_FORMAT` switches the default format for the plan | ||
(compact, short, full). The variable `TF_PROGRESS_FORMAT` switches the | ||
default format for the progress indicator (counters, fan, dots, verbose, | ||
verbatim). | ||
|
||
### `tf rm` | ||
|
||
The same as `terraform state rm` with less verbose output. | ||
|
||
The command accepts multiple arguments. If argument misses quotes inside square | ||
brackets then they will be added. | ||
The command accepts multiple arguments. If the argument misses quotes inside | ||
square brackets then they will be added. | ||
|
||
### `tf show` | ||
|
||
|
@@ -268,21 +274,21 @@ and ANSI stripped. | |
`terraform show` is used when the command is run without arguments and | ||
`terraform state show` when arguments are used. | ||
|
||
The command accepts multiple arguments. If argument misses quotes inside square | ||
brackets then they will be added. | ||
The command accepts multiple arguments. If the argument misses quotes inside | ||
square brackets then they will be added. | ||
|
||
Additional option can be used: `-no-outputs` hides outputs (default, | ||
An additional option can be used: `-no-outputs` hides outputs (default, | ||
`-no-outputs=false` shows it again). | ||
|
||
### `tf taint` | ||
|
||
The same as `terraform taint` and it accepts multiple arguments. If argument | ||
misses quotes inside square brackets then they will be added. | ||
The same as `terraform taint` and it accepts multiple arguments. If the | ||
argument misses quotes inside square brackets then they will be added. | ||
|
||
### `tf untaint` | ||
|
||
The same as `terraform untaint` and it accepts multiple arguments. If argument | ||
misses quotes inside square brackets then they will be added. | ||
The same as `terraform untaint` and it accepts multiple arguments. If the | ||
argument misses quotes inside square brackets then they will be added. | ||
|
||
### `tf upgrade` | ||
|
||
|
@@ -298,6 +304,6 @@ applications with unrecognized signature. | |
|
||
## License | ||
|
||
Copyright (c) 2020-2023 Piotr Roszatycki <[email protected]> | ||
Copyright (c) 2020-2024 Piotr Roszatycki <[email protected]> | ||
|
||
[MIT](https://opensource.org/licenses/MIT) |