Convert Cloudformation Templates to Terraform.
Project description
Cloudformation 2 Terraform
Convert your Cloudformation templates to Terraform.
Report Bug
·
Request Feature
·
Table of Contents
About The Project
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.
Getting Started
Prerequisites
Cloudformation 2 Terraform requires python >= 3.8
Installation
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
Usage
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.).
Roadmap
- Better conversion of Cloudformation Maps to Terraform (Maps, Block and json)
- Allow overides for specific resources
- Handle more advanced Cloudformation parameter types like SSM/Secrets manager
- Better handling of Recources/Properties that failed conversion
- Only download files needed, not entire terraform source code (200MB)
See the open issues for a list of proposed features (and known issues).
Contributing
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.12.
-
Fork the Project
-
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
andpre-commit
packages. Then runpoetry install
andpre-commit install
commands.Most of the steps can be found in the Dockerfile.
-
Create your Feature Branch (
git checkout -b feature/AmazingFeature
) -
Commit your Changes (
git commit -m 'Add some AmazingFeature'
) -
Push to the Branch (
git push origin feature/AmazingFeature
) -
Open a Pull Request
Contact
Levi - @shady_cuz
Acknowledgements
- Cloud-Radar - A unit/functional testing framework for Cloudformation templates.
- cfn_tools from cfn-flip - Used to convert template from yml to python dict.
- Best-README-Template - The name says it all.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file cf2tf-0.9.0.tar.gz
.
File metadata
- Download URL: cf2tf-0.9.0.tar.gz
- Upload date:
- Size: 38.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.4.0 CPython/3.12.7 Linux/6.5.0-1025-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e0227b6ab2bcb9d5c4e517e4a6c013b758ed51f41e0fdd5c2570a2f586b47256 |
|
MD5 | a15074bf6edf02e022c1d4af8cd37885 |
|
BLAKE2b-256 | e49d79064ec7a79fcde16fc17c3261059f60b6da6ebc5ee5c9a7eb19c3f55c8b |
File details
Details for the file cf2tf-0.9.0-py3-none-any.whl
.
File metadata
- Download URL: cf2tf-0.9.0-py3-none-any.whl
- Upload date:
- Size: 41.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.4.0 CPython/3.12.7 Linux/6.5.0-1025-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d7f2af85a87731a6de621d73cf97751dc5b609e4c47cbdee7bbf261cebef433f |
|
MD5 | 12a0d5b7cc213f598a480114652eaaf8 |
|
BLAKE2b-256 | 68d2f943b121f50e7c2c735e3aed7fd15ba9de3e75a587fb745350ad29d10842 |