Convert your Cloudformation templates to Terraform.
Report Bug
·
Request Feature
·
cf2tf
is a CLI tool that attempts to convert Cloudformation to Terraform. We say attempt because it's not really possible to make the conversion with 100% accuracy (currently) because of several reasons mostly around converting a Map value in Cloudformation to the correct value in HCL.
Cloudformation 2 Terraform requires python >= 3.8
cf2tf is available as an easy to install pip package.
pip install cf2tf
If you are a Homebrew user, can you install via brew:
$ brew install cf2tf
To convert a template to terraform.
cf2tf my_template.yaml
This above command will dump all the terraform resources to stdout. You might want to save the results:
cf2tf my_template.yaml > main.tf
If you prefer to have each resource in its own file then:
cf2tf my_template.yaml -o some_dir
If some_dir
doesn't exist, then it will be created for you. Then each resource type will be saved to a specific file (variables.tf, outputs.tf etc.).
See the open issues for a list of proposed features (and known issues).
Contributions are what make the open-source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
This project uses poetry to manage dependencies and pre-commit to run formatting, linting and tests. You will need to have both installed to your system as well as python 3.11.
Setup the environment. This project uses vscode devcontainer to provide a completly configured development environment. If you are using vscode and have the remote container extension installed, you should be asked to use the devcontainer when you open this project inside of vscode.
If you are not using devcontainers then you will need to have python installed. Install the poetry
, nox
, nox_poetry
and pre-commit
packages. Then run poetry install
and pre-commit install
commands.
Most of the steps can be found in the Dockerfile.
git checkout -b feature/AmazingFeature
)git commit -m 'Add some AmazingFeature'
)git push origin feature/AmazingFeature
)Levi - @shady_cuz