- Notifications
You must be signed in to change notification settings - Fork12
🎯tftarget is a CLI tool for Terraform ( plan | apply | destroy ) with target option. You can interactivity select resource to ( plan | apply | destroy ) with target option.
License
future-architect/tftarget
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
A Terraform ( plan | apply | destroy ) target tool
You can interactivity select resource to ( plan | apply | destroy ) with target option.
The tftarget invokes the Terraform command, so Terraform must be installed on the local environment.
We have prepared a sandbox environment where Terraform can be run in a Docker environment, so please clone the repository and try it out.
$ git clone https://github.com/future-architect/tftarget.git
First, build localstack
$ make localstack
Then, change directory, following command.
$cd sandbox
Now that localstack has started, you should be able to run Terraform.
Please run the following command to confirm that Terraform is functioning properly.
$ terraform init$ terraform plan
Once you have reached this point, the preparation is complete.
$ go install github.com/future-architect/tftarget@latest
$ brew install future-architect/tap/tftarget
Download the latest compiled binaries and put it anywhere in your executable path.
https://github.com/future-architect/tftarget/releases
$ tftarget --helptftarget is a CLI libraryfor Terraform ( plan| appply| destroy ) with target option.You can interactivityselectresource to ( plan| appply| destroy ) with target option.Usage: tftarget [command]Available Commands: apply Terraform apply, interactivelyselectresource to apply with target option completion Generate the autocompletion scriptfor the specified shell destroy Terraform destroy, interactivelyselectresource to destroy with target optionhelp Help about anycommand plan Terraform plan, interactivelyselectresource to plan with target optionFlags: -h, --helphelpfor tftarget -v, --version versionfor tftargetUse"tftarget [command] --help"for more information about a command.
$ tftarget plan
Executing atftarget plan
is equivalent to executing aterraform plan
.The difference from a normalterraform plan
is that instead of s detailed plan results, the output is a checkbox with only the resource name and action name displayed.
By selecting this checkbox and executing, the terraform plan can be executed for the selected resource with the target option.
Finally, selected result is output as a summary.
tftarget apply
is the same flow until thetftarget plan
and resource are selected.The difference is that after selecting a resource, you will be prompted to enteryes
, which will executeterraform apply
.
As with thetftarget plan
, the selected resource is output as a summary.
The use oftftarget destroy
is exactly the same as that oftftarget apply
, so we omit the explanation here.
plan, apply, and destroy each have Flags options as shown below.
Flags: -f, --filter string filter by action. You canselectcreate, destroy, update, or replace -i, --items int check box item size (default 25) -p, --parallel int limit the number of concurrent operations (default 10) -s, --summary summary of selected items (default true)
The filter option allows you to filter actions on the first resource selection screen.For example, if you want to display only newly created resources as an option, do the following
tftarget apply -f create
This option is not available for combined use.For example, the following commands are treated as invalid
tftarget apply -f create destroy
This option allows you to change the number of checkbox choices. The default setting is 25.If you wish to increase the number of checkboxes to 50, do the following.
tftarget apply -i 50
--parallel is equivalent to the -parallelism=n option in terraform. The default is set to 10.
tftarget apply -p 30
--summary option is set to true by default. If it is set to false, the following output will be hidden.
tftarget apply -sfalse
About
🎯tftarget is a CLI tool for Terraform ( plan | apply | destroy ) with target option. You can interactivity select resource to ( plan | apply | destroy ) with target option.