• Stars
    star
    237
  • Rank 169,885 (Top 4 %)
  • Language
    Go
  • License
    MIT License
  • Created over 1 year ago
  • Updated about 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

🎯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.

tftarget

License: MIT Go Reference release tagpr

A Terraform ( plan | apply | destroy ) target tool

tftarget-logo

Features

You can interactivity select resource to ( plan | apply | destroy ) with target option.

日本語の紹介記事はこちら

tftarget plan

tftarget-plan

tftarget apply

tftarget-apply

tftarget destroy

tftarget-destroy

Requirements

The tftarget invokes the Terraform command, so Terraform must be installed on the local environment.

Getting Started

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.

Install

Go

$ go install github.com/future-architect/tftarget@latest

Homebrew

$ brew install future-architect/tap/tftarget

Download

Download the latest compiled binaries and put it anywhere in your executable path.

https://github.com/future-architect/tftarget/releases

Usage

$ tftarget --help
tftarget is a CLI library for Terraform ( plan | appply | destroy ) with target option.
You can interactivity select resource to ( plan | appply | destroy ) with target option.

Usage:
  tftarget [command]

Available Commands:
  apply       Terraform apply, interactively select resource to apply with target option
  completion  Generate the autocompletion script for the specified shell
  destroy     Terraform destroy, interactively select resource to destroy with target option
  help        Help about any command
  plan        Terraform plan, interactively select resource to plan with target option

Flags:
  -h, --help      help for tftarget
  -v, --version   version for tftarget

Use "tftarget [command] --help" for more information about a command.

Simple Usage

Plan

$ tftarget plan

simple-usage-1

Executing a tftarget plan is equivalent to executing a terraform plan. The difference from a normal terraform 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.

simple-usage-2

Finally, selected result is output as a summary.

simple-usage-3

Apply

tftarget apply is the same flow until the tftarget plan and resource are selected. The difference is that after selecting a resource, you will be prompted to enter yes, which will execute terraform apply.

simple-usage-4

As with the tftarget plan, the selected resource is output as a summary.

simple-usage-5

Destroy

The use of tftarget destroy is exactly the same as that of tftarget apply, so we omit the explanation here.

Advanced Option

plan, apply, and destroy each have Flags options as shown below.

Flags:
  -f, --filter string   filter by action. You can select create, 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)

--filter, -f

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

--items, -i

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, -p

--parallel is equivalent to the -parallelism=n option in terraform. The default is set to 10.

tftarget apply -p 30

--summary, -s

--summary option is set to true by default. If it is set to false, the following output will be hidden.

simple-usage-5

tftarget apply -s false

License

MIT

More Repositories

1

vuls

Agent-less vulnerability scanner for Linux, FreeBSD, Container, WordPress, Programming language libraries, Network devices
Go
10,885
star
2

cheetah-grid

The fastest open-source data table for web.
JavaScript
1,427
star
3

typescript-guide

ゼロから学ぶTypeScriptガイド
Python
472
star
4

icons

Open Source Icons designed by Future Architect.
136
star
5

eslint-plugin-vue-scoped-css

ESLint plugin for Scoped CSS in Vue.js
TypeScript
97
star
6

coding-standards

A coding standards for enterprise system
JavaScript
87
star
7

uroborosql

Developer-oriented and SQL centric database access library
Java
85
star
8

puml-themes

PlantUML thema
59
star
9

go-mcprotocol

MC Protocol(MELSEC Communication Protocol) client implementation for golang
Go
41
star
10

uroboroSQL-formatter

Beautiful SQL Formatter
Python
39
star
11

uroborosql-fmt

Rust
35
star
12

urushi

Web Component framework.
JavaScript
34
star
13

watertower

serverless search engine
Go
32
star
14

gcp-instance-scheduler

Tools that shutdown GCP Instance on your schedule.
Go
31
star
15

awsmfa

replaces the credentials for MFA in AWS
Go
30
star
16

tech-blog

tech blog
Stylus
24
star
17

Sublime-uroboroSQL-formatter

Beautiful SQL Formatter for Sublime Text 3
Python
24
star
18

future-wru

Identity Aware Proxy
Go
20
star
19

future-architect.github.io

Stylus
18
star
20

idea-uroborosql-formatter

Beautiful SQL Formatter for IntelliJ Platform
Java
17
star
21

redmine_slack_integration

The redmine plugin for the integration of slack and redmine
Ruby
16
star
22

gbilling2slack

Slack notifications tools for Google Cloud Platform Billing.
Go
16
star
23

redmine_gitlab_adapter

'This is a Gitlab Adapter plugin for Redmine'
Ruby
15
star
24

docradle

Helper tool for Docker container
Go
12
star
25

go-twowaysql

2-Way-SQL Go implementation
Go
12
star
26

futureot

OpenCensus (OpenTelemetry) helper functions
Go
11
star
27

gbilling-plot

Create graphed invoice for Google Cloud Platform. You can see billing amount per GCP project.
Go
11
star
28

code-diaper

CodeDiaper is a tool for detecting code leaks.
Go
8
star
29

redmine_hangouts_chat_integration

The redmine plugin for the integration of google hangouts chat and redmine
Ruby
8
star
30

vscode-uroborosql-fmt

uroboroSQL-fmt for VSCode
TypeScript
6
star
31

eclipse-uroborosql-formatter

Beautiful SQL Formatter for Eclipse
Java
5
star
32

giglocal

giglocal is GCP emulator docker image for developping local testing.
Go
5
star
33

reguerr

reguerr - Code generator for systematic error handling
Go
4
star
34

LoadRunnerSamples

Sample scripts for HPE LoadRunner in C
C
4
star
35

linkedpackage

Filter package list by actual usage
Go
3
star
36

a5er-dictionary

Go
3
star
37

apidoor

apidoor is a framework that can be used to build a WebAPI platform
Go
3
star
38

uroborosql-sample

uroborosql usecase sample
Java
3
star
39

go-exceltesting

Go data insert into dababase tool for table driven testing using excel
Go
3
star
40

redmine_single_mail

Ruby
3
star
41

backlogslackify

Go
2
star
42

uroborosql-doc

uroboroSQL documentation
HTML
1
star
43

gocloudurls

gcloud.dev helper to manage urls
Go
1
star