Refactors terraform code generated by terraformer.
It does two things
- Merges all the terraform states.
- Some post processing
npm i -g terrafactor
terrafactor ./inputDir ./outputDir
It will generate three directories
If you want to opt out of the modularize feature. You can run.
terrafactor ./inputDir ./outputDir --modularize=false
Currently it does the following postprocessing steps
- Replaces all hardcoded
- Maintains DRY-ness by refactoring out repeated values into a
- Generate modules containing clusters of all connected components. Then have the
main.tfimport all the modules.
mod_0constains all resources which have a very small cluster
( < 2 )
- Support for
countproperty of terraform.