terrafactor

0.2.1 • Public • Published

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.

Package Sidebar

Install

npm i terrafactor

Weekly Downloads

3

Version

0.2.1

License

MIT

Unpacked Size

32.1 kB

Total Files

11

Last publish

Collaborators

  • ghost---shadow