tfsort

command module
v0.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 24, 2023 License: Apache-2.0 Imports: 1 Imported by: 0

README

tfsort

badge-gh-release badge-gh-tests go-report-card go-test-coverage

Logo

tfsort is a command-line utility designed for meticulous engineers who prefer to keep their Terraform variables and outputs sorted in alphabetical order.

tfsort also corrects any spacing issues between the blocks and removes any leading or trailing new lines in the file.

Demo

Demo

Installation

Homebrew

To install tfsort using Homebrew, run the following command:

  1. Add the tap:
brew tap alexnabokikh/tfsort
  1. Install tfsort:
brew install tfsort
Binary release

To install tfsort, you can download the latest binary release from the releases page.

From source

Alternatively, you can build tfsort from the source by cloning the repository and running go build.

Usage

The basic usage of tfsort is as follows:

tfsort --file <path-to-tf-file> [--out <path-to-output-file>] [--dry-run]

Available flags:

  • --file: the path to the .tf file you want to sort. This flag is optional.
  • --out: the path to the output file. If not provided, tfsort will overwrite the input file.
  • --dry-run: preview the changes without altering the original file.

Examples

Here's an example of using tfsort to sort a Terraform file called main.tf:

tfsort variables.tf

This will sort the resources in variables.tf in place. You can also use the --out flag to specify an output file:

tfsort --file variables.tf --out sorted.tf

This will create a new file called sorted.tf with the sorted resources.

Author

This project was created by Alexander Nabokikh.

License

This software is available under the following licenses:

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL