Refactors terraform code generated by terraformer.
It does two things
- Merges all the terraform states.
- Some post processing
Requires nodejs
npm i -g terrafactorterrafactor ./inputDir ./outputDirIt 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=falseCurrently it does the following postprocessing steps
- Replaces all hardcoded
idwith"${resource_type.resource_name.id}" - Maintains DRY-ness by refactoring out repeated values into a
variables.tffile. - 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 )
Planned
- Support for
countproperty of terraform.