Skip to main content

Python Latest Tests Coverage License


Cloudformation 2 Terraform

Convert your Cloudformation templates to Terraform.
Report Bug · Request Feature ·

Table of Contents
  1. About The Project
  2. Getting Started
  3. Usage
  4. Roadmap
  5. Contributing
  6. Contact
  7. Acknowledgements

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.11.

  1. Fork the Project

  2. 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.

  3. Create your Feature Branch (git checkout -b feature/AmazingFeature)

  4. Commit your Changes (git commit -m 'Add some AmazingFeature')

  5. Push to the Branch (git push origin feature/AmazingFeature)

  6. Open a Pull Request

Contact

Levi - @shady_cuz

Acknowledgements

Release files for cf2tf 0.6.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cf2tf 0.6.3
File Size Uploaded
cf2tf-0.6.3.tar.gz 37.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for cf2tf 0.6.3
File Interpreter ABI Platform
cf2tf-0.6.3-py3-none-any.whl Python 3 none any Details

Total release size: 78.8 kB

Release files / cf2tf-0.6.3.tar.gz

Download URL cf2tf-0.6.3.tar.gz
Size 37.6 kB
Tags Source
SHA-256 checksum
How to use checksums
ea6ea854524e0ce36387a65203447c54b08cccf0ab1cf58647c93c13233cbf5d
BLAKE2b-256 checksum
How to use checksums
369487ce5c09fe600564e7c01baa9a66beecd8a7934b6eab81188494c2d5db10
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.4.0 CPython/3.11.9 Linux/6.5.0-1018-azure

Release files / cf2tf-0.6.3-py3-none-any.whl

Download URL cf2tf-0.6.3-py3-none-any.whl
Size 41.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2502a23567d6c346b87fc5473f7c2d26b855e308c7c93372f8e2533b9e7a0325
BLAKE2b-256 checksum
How to use checksums
610be7df3fd2d39777073d98874f4d22dd52ae2ac9d3dbdbbba258a03f28a7da
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.4.0 CPython/3.11.9 Linux/6.5.0-1018-azure

Release history Release notifications | RSS feed

0.9.2

2 release files

0.9.1

2 release files

0.9.0

2 release files

0.8.0

2 release files

0.7.1

2 release files

0.7.0

2 release files

This release

0.6.3 This release

2 release files

0.6.2

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.0

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.7

2 release files

0.2.6

2 release files

0.2.5

2 release files

0.2.4

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page