Metadata-Version: 2.1
Name: tfpy
Version: 0.4.0
Summary: Create Terraform resources using Python
Home-page: https://rgreinho.github.io/tfpy
License: MIT
Keywords: terraform
Author: Rémy Greinhofer
Author-email: remy.greinhofer@gmail.com
Requires-Python: >=3.7,<4.0
Classifier: Development Status :: 5 - Production/Stable
Classifier: Environment :: Console
Classifier: Intended Audience :: End Users/Desktop
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: MacOS :: MacOS X
Classifier: Operating System :: Microsoft :: Windows
Classifier: Operating System :: POSIX :: Linux
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Topic :: Utilities
Requires-Dist: loguru (>=0.4.1,<0.5.0)
Requires-Dist: pyyaml (>=5.3.1,<6.0.0)
Requires-Dist: terraformpy (==1.3.0)
Requires-Dist: typer (>=0.2.1,<0.3.0)
Project-URL: Documentation, https://rgreinho.github.io/tfpy
Project-URL: Repository, https://github.com/rgreinho/tfpy
Description-Content-Type: text/x-rst

tfpy
====

.. image:: https://github.com/rgreinho/tfpy/workflows/ci/badge.svg
   :target: https://github.com/rgreinho/tfpy/actions?query=workflow%3Aci

.. image:: https://badge.fury.io/py/scrapd.svg
   :target: https://badge.fury.io/py/scrapd

Create Terraform resources using Python.

Description
-----------

``tfpy`` is a thin wrapper around `terraformpy`_, aiming at providing a well defined
structure to organize your `terraform`_ stacks and leverage the power of Python to
define them rather than using `HCL`_.

The goal is to have a repository layout inspired from `Ansible <https://docs.ansible.com/ansible/latest/user_guide/playbooks_best_practices.html#directory-layout>`_
where the stacks are driven by the variables.

For more information regarding how to create your stacks, please refer to the official
`terraformpy`_ documentation.

Installation
------------

tfpy requires Python 3.7+ to work

::

  pip install tfpy

Usage
-----

The ``tfpy`` command needs to be run at the root of your project.

The output will be created in a new subfolder within your project, named ``generated``.
For instance ``generated/gke/production/main.tf.json``

Project layout
^^^^^^^^^^^^^^

::

  .
  ├── generated
  │   └── commerce
  │       └── staging
  │           └── main.tf.json
  ├── library
  │   ├── backend.py
  │   └── provider.py
  ├── stacks
  │   └── commerce
  │       ├── README.md
  │       ├── gke.tf.py
  │       └── terraform.tf.py
  └── vars
      ├── all
      │   ├── cartigan.yml
      │   └── config.yml
      └── staging
          └── commerce
              ├── gke.yml
              └── project.yml

* ``generated``: folder where the stack are stored as JSON once generated.
* ``library``: folder where you can place custom functions.
* ``stacks``: the stacks created using TerraformPy.
* ``vars``: the variables used to create the stacks.

Examples
^^^^^^^^

Build a project stack without an environment::

  tfpy generate organization

Build a project stack for a specific environment::

  tfpy generate gke production


.. _HCL: https://github.com/hashicorp/hcl
.. _terraform: https://www.terraform.io
.. _terraformpy: https://github.com/NerdWalletOSS/terraformpy

