Skip to content

Shell-based wrapper for Terraform to simplify resource targeting

Notifications You must be signed in to change notification settings

soar/terraform-target

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Terraform-Target

Shell-based wrapper to simplify resource targeting

asciicast

  • Works with wrappers like tfenv
  • Works and tested with Terraform 1.0 and higher
  • Allows passing any parameters to the terraform binary
  • Allows reviewing the changes once more

Installation

  • Install fzf
  • Download the script terraform-target
  • Place it into your PATH
  • Check, that all required tools are installed: terraform-target check-requirements

Usage

All commands can be supplied with additional Terraform parameters, they all are passed as is

terraform-target apply

Executes terraform plan and shows possible targets list to choose from. After that, executes terraform apply -target=... on the targets selected.

terraform-target apply-repeat

Executes terraform apply -target=... on targets, that were previously selected in this shell. Useful, when you need to re-apply the same changes, if the previous apply failed.

terraform-target replace

Shows known resources in the state to choose from. After that, executes terraform apply -replace=... on the targets selected.

terraform-target destroy

Shows known resources in the state to choose from. After that, executes terraform destroy -target=... on the targets selected.


Written with ❤️ and without ChatGPT help ☺️