0.2.1 • Published 4 years ago

terrafactor v0.2.1

Weekly downloads
1
License
MIT
Repository
github
Last release
4 years ago

Terrafactor

Refactors terraform code generated by terraformer.

It does two things

  1. Merges all the terraform states.
  2. Some post processing

Installation

Requires nodejs

npm i -g terrafactor

Usage

terrafactor ./inputDir ./outputDir

It will generate three directories ./outputDir, ./outputDir_mst and ./outputDir_processed.

If you want to opt out of the modularize feature. You can run.

terrafactor ./inputDir ./outputDir --modularize=false

Post processing

Currently it does the following postprocessing steps

  1. Replaces all hardcoded id with "${resource_type.resource_name.id}"
  2. Maintains DRY-ness by refactoring out repeated values into a variables.tf file.
  3. Generate modules containing clusters of all connected components. Then have the main.tf import all the modules. mod_0 constains all resources which have a very small cluster ( < 2 )

Planned

  1. Support for count property of terraform.