tftool

Ergonomic utilities for the terraform CLI.

Usage

# Force terraform to be a bit more Unix philosophy
alias tfplan="terraform plan -refresh=false -input=false -out=/tmp/plan > /dev/null && terraform show -json /tmp/plan"
alias tfapply="xargs -or0 terraform apply"
alias tfimport="xargs -or0L2 terraform import"

# Only create new resources
tfplan | tftool target --no-updates | tfapply

# Automatically import new resources if their name/index matches the id.
tfplan | tftool autoimport | tfimport

Installation

python3 -m pip install tftool

tftool

Command line entrypoint.

usage: tftool [-h] {targets,target,autoimport} ...
-h, --help

show this help message and exit

tftool autoimport

usage: tftool autoimport [-h] [-r REGEX]
-h, --help

show this help message and exit

-r <regex>, --regex <regex>

Regex to select targets.

tftool target

usage: tftool target [-h] [-u | --updates | --no-updates]
                     [-c | --creates | --no-creates]
                     [-d | --destroys | --no-destroys]
                     [-n | --noops | --no-noops] [-r REGEX]
-h, --help

show this help message and exit

-u, --updates, --no-updates

Targets about to be updated. (default: True)

-c, --creates, --no-creates

Targets about to be created. (default: True)

-d, --destroys, --no-destroys

Targets to be destroyed. (default: False)

-n, --noops, --no-noops

Targets that are up to date. (default: False)

-r <regex>, --regex <regex>

Regex to select targets.

tftool targets

usage: tftool targets [-h] [-u | --updates | --no-updates]
                      [-c | --creates | --no-creates]
                      [-d | --destroys | --no-destroys]
                      [-n | --noops | --no-noops] [-r REGEX]
-h, --help

show this help message and exit

-u, --updates, --no-updates

Targets about to be updated. (default: True)

-c, --creates, --no-creates

Targets about to be created. (default: True)

-d, --destroys, --no-destroys

Targets to be destroyed. (default: False)

-n, --noops, --no-noops

Targets that are up to date. (default: False)

-r <regex>, --regex <regex>

Regex to select targets.


Ergonomic utilities for the terraform CLI.

Indices and tables