cf2tf


Namecf2tf JSON
Version 0.9.0 PyPI version JSON
download
home_pagehttps://github.com/DontShaveTheYak/cf2tf
SummaryConvert Cloudformation Templates to Terraform.
upload_time2024-11-18 23:09:00
maintainerNone
docs_urlNone
authorLevi Blaney
requires_python<3.14,>=3.9
licenseGPL-3.0-only
keywords cloudformation terraform cf2tf convert cloud conversion
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <!-- PROJECT SHIELDS -->
<!--
*** I'm using markdown "reference style" links for readability.
*** Reference links are enclosed in brackets [ ] instead of parentheses ( ).
*** See the bottom of this document for the declaration of the reference variables
*** for contributors-url, forks-url, etc. This is an optional, concise syntax you may use.
*** https://www.markdownguide.org/basic-syntax/#reference-style-links
-->
[![Python][python-shield]][pypi-url]
[![Latest][version-shield]][pypi-url]
[![Tests][test-shield]][test-url]
[![Coverage][codecov-shield]][codecov-url]
[![License][license-shield]][license-url]
<!-- [![Contributors][contributors-shield]][contributors-url]
[![Forks][forks-shield]][forks-url]
[![Stargazers][stars-shield]][stars-url]
[![Issues][issues-shield]][issues-url] -->

<!-- PROJECT LOGO -->
<br />
<p align="center">
  <!-- <a href="https://github.com/DontShaveTheYak/cf2tf">
    <img src="images/logo.png" alt="Logo" width="80" height="80">
  </a> -->

  <h3 align="center">Cloudformation 2 Terraform</h3>

  <p align="center">
    Convert your Cloudformation templates to Terraform.
    <!-- <br />
    <a href="https://github.com/DontShaveTheYak/cf2tf"><strong>Explore the docs »</strong></a>
    <br /> -->
    <br />
    <!-- <a href="https://github.com/DontShaveTheYak/cf2tf">View Demo</a>
    · -->
    <a href="https://github.com/DontShaveTheYak/cf2tf/issues">Report Bug</a>
    ·
    <a href="https://github.com/DontShaveTheYak/cf2tf/issues">Request Feature</a>
    ·
    <!-- <a href="https://la-tech.co/post/hypermodern-cloudformation/getting-started/">Guide</a> -->
  </p>
</p>



<!-- TABLE OF CONTENTS -->
<details open="open">
  <summary>Table of Contents</summary>
  <ol>
    <li>
      <a href="#about-the-project">About The Project</a>
    </li>
    <li>
      <a href="#getting-started">Getting Started</a>
      <ul>
        <li><a href="#prerequisites">Prerequisites</a></li>
        <li><a href="#installation">Installation</a></li>
      </ul>
    </li>
    <li><a href="#usage">Usage</a></li>
    <li><a href="#roadmap">Roadmap</a></li>
    <li><a href="#contributing">Contributing</a></li>
    <!-- <li><a href="#license">License</a></li> -->
    <li><a href="#contact">Contact</a></li>
    <li><a href="#acknowledgements">Acknowledgements</a></li>
  </ol>
</details>

## About The Project

<!-- [![Product Name Screen Shot][product-screenshot]](https://example.com) -->

`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](https://github.com/hashicorp/hcl/issues/294#issuecomment-446388342).

## Getting Started

### Prerequisites

Cloudformation 2 Terraform requires python >= 3.8

### Installation

cf2tf is available as an easy to install pip package.
```sh
pip install cf2tf
```

If you are a [Homebrew](https://brew.sh/) user, can you install via brew:

```
$ brew install cf2tf
```

## Usage

To convert a template to terraform.
```sh
cf2tf my_template.yaml
```

This above command will dump all the terraform resources to stdout. You might want to save the results:
```sh
cf2tf my_template.yaml > main.tf
```

If you prefer to have each resource in its own file then:
```sh
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](https://github.com/DontShaveTheYak/cf2tf/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](.devcontainer/Dockerfile).
2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)
3. Commit your Changes (`git commit -m 'Add some AmazingFeature'`)
4. Push to the Branch (`git push origin feature/AmazingFeature`)
5. Open a Pull Request

<!-- ## License

Distributed under the Apache-2.0 License. See [LICENSE.txt](./LICENSE.txt) for more information. -->

## Contact

Levi - [@shady_cuz](https://twitter.com/shady_cuz)

<!-- ACKNOWLEDGEMENTS -->
## Acknowledgements
* [Cloud-Radar](https://github.com/DontShaveTheYak/cloud-radar) - A unit/functional testing framework for Cloudformation templates.
* [cfn_tools from cfn-flip](https://github.com/awslabs/aws-cfn-template-flip) - Used to convert template from yml to python dict.
* [Best-README-Template](https://github.com/othneildrew/Best-README-Template) - The name says it all.

<!-- MARKDOWN LINKS & IMAGES -->
<!-- https://www.markdownguide.org/basic-syntax/#reference-style-links -->
[python-shield]: https://img.shields.io/pypi/pyversions/cf2tf?style=for-the-badge
[version-shield]: https://img.shields.io/pypi/v/cf2tf?label=latest&style=for-the-badge
[pypi-url]: https://pypi.org/project/cf2tf/
[test-shield]: https://img.shields.io/github/actions/workflow/status/DontShaveTheYak/cf2tf/test.yml?label=Tests&style=for-the-badge
[test-url]: https://github.com/DontShaveTheYak/cf2tf/actions?query=workflow%3ATests+branch%3Amaster
[codecov-shield]: https://img.shields.io/codecov/c/gh/DontShaveTheYak/cf2tf/master?color=green&style=for-the-badge&token=bfF18q99Fl
[codecov-url]: https://codecov.io/gh/DontShaveTheYak/cf2tf
[contributors-shield]: https://img.shields.io/github/contributors/DontShaveTheYak/cf2tf.svg?style=for-the-badge
[contributors-url]: https://github.com/DontShaveTheYak/cf2tf/graphs/contributors
[forks-shield]: https://img.shields.io/github/forks/DontShaveTheYak/cf2tf.svg?style=for-the-badge
[forks-url]: https://github.com/DontShaveTheYak/cf2tf/network/members
[stars-shield]: https://img.shields.io/github/stars/DontShaveTheYak/cf2tf.svg?style=for-the-badge
[stars-url]: https://github.com/DontShaveTheYak/cf2tf/stargazers
[issues-shield]: https://img.shields.io/github/issues/DontShaveTheYak/cf2tf.svg?style=for-the-badge
[issues-url]: https://github.com/DontShaveTheYak/cf2tf/issues
[license-shield]: https://img.shields.io/github/license/DontShaveTheYak/cf2tf.svg?style=for-the-badge
[license-url]: https://github.com/DontShaveTheYak/cf2tf/blob/master/LICENSE.txt
[product-screenshot]: images/screenshot.png

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/DontShaveTheYak/cf2tf",
    "name": "cf2tf",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<3.14,>=3.9",
    "maintainer_email": null,
    "keywords": "cloudformation, terraform, cf2tf, convert, cloud, conversion",
    "author": "Levi Blaney",
    "author_email": "shadycuz@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/e4/9d/79064ec7a79fcde16fc17c3261059f60b6da6ebc5ee5c9a7eb19c3f55c8b/cf2tf-0.9.0.tar.gz",
    "platform": null,
    "description": "<!-- PROJECT SHIELDS -->\n<!--\n*** I'm using markdown \"reference style\" links for readability.\n*** Reference links are enclosed in brackets [ ] instead of parentheses ( ).\n*** See the bottom of this document for the declaration of the reference variables\n*** for contributors-url, forks-url, etc. This is an optional, concise syntax you may use.\n*** https://www.markdownguide.org/basic-syntax/#reference-style-links\n-->\n[![Python][python-shield]][pypi-url]\n[![Latest][version-shield]][pypi-url]\n[![Tests][test-shield]][test-url]\n[![Coverage][codecov-shield]][codecov-url]\n[![License][license-shield]][license-url]\n<!-- [![Contributors][contributors-shield]][contributors-url]\n[![Forks][forks-shield]][forks-url]\n[![Stargazers][stars-shield]][stars-url]\n[![Issues][issues-shield]][issues-url] -->\n\n<!-- PROJECT LOGO -->\n<br />\n<p align=\"center\">\n  <!-- <a href=\"https://github.com/DontShaveTheYak/cf2tf\">\n    <img src=\"images/logo.png\" alt=\"Logo\" width=\"80\" height=\"80\">\n  </a> -->\n\n  <h3 align=\"center\">Cloudformation 2 Terraform</h3>\n\n  <p align=\"center\">\n    Convert your Cloudformation templates to Terraform.\n    <!-- <br />\n    <a href=\"https://github.com/DontShaveTheYak/cf2tf\"><strong>Explore the docs \u00bb</strong></a>\n    <br /> -->\n    <br />\n    <!-- <a href=\"https://github.com/DontShaveTheYak/cf2tf\">View Demo</a>\n    \u00b7 -->\n    <a href=\"https://github.com/DontShaveTheYak/cf2tf/issues\">Report Bug</a>\n    \u00b7\n    <a href=\"https://github.com/DontShaveTheYak/cf2tf/issues\">Request Feature</a>\n    \u00b7\n    <!-- <a href=\"https://la-tech.co/post/hypermodern-cloudformation/getting-started/\">Guide</a> -->\n  </p>\n</p>\n\n\n\n<!-- TABLE OF CONTENTS -->\n<details open=\"open\">\n  <summary>Table of Contents</summary>\n  <ol>\n    <li>\n      <a href=\"#about-the-project\">About The Project</a>\n    </li>\n    <li>\n      <a href=\"#getting-started\">Getting Started</a>\n      <ul>\n        <li><a href=\"#prerequisites\">Prerequisites</a></li>\n        <li><a href=\"#installation\">Installation</a></li>\n      </ul>\n    </li>\n    <li><a href=\"#usage\">Usage</a></li>\n    <li><a href=\"#roadmap\">Roadmap</a></li>\n    <li><a href=\"#contributing\">Contributing</a></li>\n    <!-- <li><a href=\"#license\">License</a></li> -->\n    <li><a href=\"#contact\">Contact</a></li>\n    <li><a href=\"#acknowledgements\">Acknowledgements</a></li>\n  </ol>\n</details>\n\n## About The Project\n\n<!-- [![Product Name Screen Shot][product-screenshot]](https://example.com) -->\n\n`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](https://github.com/hashicorp/hcl/issues/294#issuecomment-446388342).\n\n## Getting Started\n\n### Prerequisites\n\nCloudformation 2 Terraform requires python >= 3.8\n\n### Installation\n\ncf2tf is available as an easy to install pip package.\n```sh\npip install cf2tf\n```\n\nIf you are a [Homebrew](https://brew.sh/) user, can you install via brew:\n\n```\n$ brew install cf2tf\n```\n\n## Usage\n\nTo convert a template to terraform.\n```sh\ncf2tf my_template.yaml\n```\n\nThis above command will dump all the terraform resources to stdout. You might want to save the results:\n```sh\ncf2tf my_template.yaml > main.tf\n```\n\nIf you prefer to have each resource in its own file then:\n```sh\ncf2tf my_template.yaml -o some_dir\n```\nIf `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.).\n\n## Roadmap\n\n- Better conversion of Cloudformation Maps to Terraform (Maps, Block and json)\n- Allow overides for specific resources\n- Handle more advanced Cloudformation parameter types like SSM/Secrets manager\n- Better handling of Recources/Properties that failed conversion\n- Only download files needed, not entire terraform source code (200MB)\n\nSee the [open issues](https://github.com/DontShaveTheYak/cf2tf/issues) for a list of proposed features (and known issues).\n\n## Contributing\n\nContributions are what make the open-source community such an amazing place to learn, inspire, and create. Any contributions you make are **greatly appreciated**.\n\n\n\nThis 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.\n\n1. Fork the Project\n2. Setup the environment.\n   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.\n\n   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.\n\n   Most of the steps can be found in the [Dockerfile](.devcontainer/Dockerfile).\n2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)\n3. Commit your Changes (`git commit -m 'Add some AmazingFeature'`)\n4. Push to the Branch (`git push origin feature/AmazingFeature`)\n5. Open a Pull Request\n\n<!-- ## License\n\nDistributed under the Apache-2.0 License. See [LICENSE.txt](./LICENSE.txt) for more information. -->\n\n## Contact\n\nLevi - [@shady_cuz](https://twitter.com/shady_cuz)\n\n<!-- ACKNOWLEDGEMENTS -->\n## Acknowledgements\n* [Cloud-Radar](https://github.com/DontShaveTheYak/cloud-radar) - A unit/functional testing framework for Cloudformation templates.\n* [cfn_tools from cfn-flip](https://github.com/awslabs/aws-cfn-template-flip) - Used to convert template from yml to python dict.\n* [Best-README-Template](https://github.com/othneildrew/Best-README-Template) - The name says it all.\n\n<!-- MARKDOWN LINKS & IMAGES -->\n<!-- https://www.markdownguide.org/basic-syntax/#reference-style-links -->\n[python-shield]: https://img.shields.io/pypi/pyversions/cf2tf?style=for-the-badge\n[version-shield]: https://img.shields.io/pypi/v/cf2tf?label=latest&style=for-the-badge\n[pypi-url]: https://pypi.org/project/cf2tf/\n[test-shield]: https://img.shields.io/github/actions/workflow/status/DontShaveTheYak/cf2tf/test.yml?label=Tests&style=for-the-badge\n[test-url]: https://github.com/DontShaveTheYak/cf2tf/actions?query=workflow%3ATests+branch%3Amaster\n[codecov-shield]: https://img.shields.io/codecov/c/gh/DontShaveTheYak/cf2tf/master?color=green&style=for-the-badge&token=bfF18q99Fl\n[codecov-url]: https://codecov.io/gh/DontShaveTheYak/cf2tf\n[contributors-shield]: https://img.shields.io/github/contributors/DontShaveTheYak/cf2tf.svg?style=for-the-badge\n[contributors-url]: https://github.com/DontShaveTheYak/cf2tf/graphs/contributors\n[forks-shield]: https://img.shields.io/github/forks/DontShaveTheYak/cf2tf.svg?style=for-the-badge\n[forks-url]: https://github.com/DontShaveTheYak/cf2tf/network/members\n[stars-shield]: https://img.shields.io/github/stars/DontShaveTheYak/cf2tf.svg?style=for-the-badge\n[stars-url]: https://github.com/DontShaveTheYak/cf2tf/stargazers\n[issues-shield]: https://img.shields.io/github/issues/DontShaveTheYak/cf2tf.svg?style=for-the-badge\n[issues-url]: https://github.com/DontShaveTheYak/cf2tf/issues\n[license-shield]: https://img.shields.io/github/license/DontShaveTheYak/cf2tf.svg?style=for-the-badge\n[license-url]: https://github.com/DontShaveTheYak/cf2tf/blob/master/LICENSE.txt\n[product-screenshot]: images/screenshot.png\n",
    "bugtrack_url": null,
    "license": "GPL-3.0-only",
    "summary": "Convert Cloudformation Templates to Terraform.",
    "version": "0.9.0",
    "project_urls": {
        "Homepage": "https://github.com/DontShaveTheYak/cf2tf",
        "Repository": "https://github.com/DontShaveTheYak/cf2tf"
    },
    "split_keywords": [
        "cloudformation",
        " terraform",
        " cf2tf",
        " convert",
        " cloud",
        " conversion"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "68d2f943b121f50e7c2c735e3aed7fd15ba9de3e75a587fb745350ad29d10842",
                "md5": "12a0d5b7cc213f598a480114652eaaf8",
                "sha256": "d7f2af85a87731a6de621d73cf97751dc5b609e4c47cbdee7bbf261cebef433f"
            },
            "downloads": -1,
            "filename": "cf2tf-0.9.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "12a0d5b7cc213f598a480114652eaaf8",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<3.14,>=3.9",
            "size": 41635,
            "upload_time": "2024-11-18T23:08:58",
            "upload_time_iso_8601": "2024-11-18T23:08:58.750987Z",
            "url": "https://files.pythonhosted.org/packages/68/d2/f943b121f50e7c2c735e3aed7fd15ba9de3e75a587fb745350ad29d10842/cf2tf-0.9.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e49d79064ec7a79fcde16fc17c3261059f60b6da6ebc5ee5c9a7eb19c3f55c8b",
                "md5": "a15074bf6edf02e022c1d4af8cd37885",
                "sha256": "e0227b6ab2bcb9d5c4e517e4a6c013b758ed51f41e0fdd5c2570a2f586b47256"
            },
            "downloads": -1,
            "filename": "cf2tf-0.9.0.tar.gz",
            "has_sig": false,
            "md5_digest": "a15074bf6edf02e022c1d4af8cd37885",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<3.14,>=3.9",
            "size": 38113,
            "upload_time": "2024-11-18T23:09:00",
            "upload_time_iso_8601": "2024-11-18T23:09:00.387674Z",
            "url": "https://files.pythonhosted.org/packages/e4/9d/79064ec7a79fcde16fc17c3261059f60b6da6ebc5ee5c9a7eb19c3f55c8b/cf2tf-0.9.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-11-18 23:09:00",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "DontShaveTheYak",
    "github_project": "cf2tf",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "cf2tf"
}
        
Elapsed time: 1.13058s