Skip to content

Commit

Permalink
CI: Publish Homebrew
Browse files Browse the repository at this point in the history
  • Loading branch information
dex4er committed Jun 21, 2024
1 parent 4f23264 commit 37c2802
Show file tree
Hide file tree
Showing 4 changed files with 80 additions and 63 deletions.
1 change: 1 addition & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,4 @@ jobs:
goreleaser release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
HOMEBREW_GITHUB_TOKEN: ${{ secrets.HOMEBREW_GITHUB_TOKEN }}
10 changes: 10 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,13 @@ checksum:

changelog:
use: github

brews:
- name: tf
description: Less verbose and more shell friendly Terraform
homepage: https://github.com/dex4er/tf
license: MIT
repository:
owner: dex4er
name: homebrew-tap
token: "{{ .Env.HOMEBREW_GITHUB_TOKEN }}"
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2020-2023 Piotr Roszatycki <piotr.roszatycki@gmail.com>
Copyright (c) 2020-2024 Piotr Roszatycki <piotr.roszatycki@gmail.com>

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
Expand Down
130 changes: 68 additions & 62 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand Down Expand Up @@ -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`

Expand All @@ -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`

Expand All @@ -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.
Expand All @@ -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`

Expand All @@ -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`

Expand All @@ -298,6 +304,6 @@ applications with unrecognized signature.

## License

Copyright (c) 2020-2023 Piotr Roszatycki <piotr.roszatycki@gmail.com>
Copyright (c) 2020-2024 Piotr Roszatycki <piotr.roszatycki@gmail.com>

[MIT](https://opensource.org/licenses/MIT)

0 comments on commit 37c2802

Please sign in to comment.