Wrapper for the Terraform CLI (as of v2.0.0-beta5, it targets the OpenTofu CLI). Provides some opinionated commands to help with Terraform CLI use. All other commands are passed directly to the Terraform CLI. It only works when run in a directory that contains a backend.tf. If no backend.tf is found, the tool exits.
As of v2.0.0-beta5, this tool targets OpenTofu because that's where my focus lies. I'll update the documentation when v2 is ready. A lot has changed.
To clean and initialize your Terraform working directory.
tf clean
- Removes the .terraform/ directory and .terraform.lock.hcl file
- Runs terraform init
To run a Terraform plan in quiet mode, which removes drift output for clarity.
tf qplan
- Runs terraform plan and filters the output
Your output will resemble the following.
Note: Objects have changed outside of Terraform
---- 12 lines hidden ----
No changes. Your infrastructure matches the configuration.
Your configuration already matches the changes detected above. If you'd like to update the Terraform state to match, create and apply a refresh-only plan.
For rapid development of Terraform config. This command modifies config files but backend.tf and providers.tf, so the next apply will tear down the resources. Used in conjunction with tf on.
tf off
- Adds the .off extension to config files in the current directory (with the exception of backend.tf and providers.tf).
For rapid development of Terraform config. This command modifies config files so the next apply will stand up the resources. Used in conjunction with tf off.
tf on
- Removes the .off extension from config files in the current directory.
Because sometimes I don't want to do a clean, then a plan.
tf replan
- Runs
init -upgrade
, thenplan
.
Out of the box, test
requires some extra steps I don't want to do.
tf test
- Runs
fmt -recursive
, theninit -upgrade
, thentest
.