Skip to main content

Convert Cloudformation Templates to Terraform.

Project description

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

  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

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

cf2tf-0.9.3a14.tar.gz (37.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cf2tf-0.9.3a14-py3-none-any.whl (41.7 kB view details)

Uploaded Python 3

File details

Details for the file cf2tf-0.9.3a14.tar.gz.

File metadata

  • Download URL: cf2tf-0.9.3a14.tar.gz
  • Upload date:
  • Size: 37.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.2.1 CPython/3.12.13 Linux/6.17.0-1010-azure

File hashes

Hashes for cf2tf-0.9.3a14.tar.gz
Algorithm Hash digest
SHA256 52b77901c9b149f9660e9d9d121954aca00cbcc2202f88122704141facb9c9b4
MD5 8d582f48c1876e0dc00f4d450747a273
BLAKE2b-256 ab2b6af90a1eb7793d4b9c1b95763db7c58dada2a3aed3915855cb787737868e

See more details on using hashes here.

File details

Details for the file cf2tf-0.9.3a14-py3-none-any.whl.

File metadata

  • Download URL: cf2tf-0.9.3a14-py3-none-any.whl
  • Upload date:
  • Size: 41.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.2.1 CPython/3.12.13 Linux/6.17.0-1010-azure

File hashes

Hashes for cf2tf-0.9.3a14-py3-none-any.whl
Algorithm Hash digest
SHA256 8ed2f7f2c8edba32fc143524d6147c4d33490791bd7e814596ebf553576ae0e4
MD5 46e5b2f6203df40454cd0554e3ed010b
BLAKE2b-256 ccb42816a7b2025c472438cfcaccfa1dbab7541e1fe5520ef333cb21404a973a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page