Skip to main content

Create Terraform resources using Python

Project description

https://github.com/rgreinho/tfpy/workflows/ci/badge.svg https://badge.fury.io/py/tfpy.svg

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tfpy-0.6.0.tar.gz (7.0 kB view details)

Uploaded Source

Built Distribution

tfpy-0.6.0-py3-none-any.whl (7.4 kB view details)

Uploaded Python 3

File details

Details for the file tfpy-0.6.0.tar.gz.

File metadata

  • Download URL: tfpy-0.6.0.tar.gz
  • Upload date:
  • Size: 7.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.0.9 CPython/2.7.17 Linux/5.3.0-1028-azure

File hashes

Hashes for tfpy-0.6.0.tar.gz
Algorithm Hash digest
SHA256 99c6f8813d745e156636b36c1f22cd7dd9dc4d70685dde377a6ba13f05151e9e
MD5 c1828ab93e85444d58a7adbf31d82684
BLAKE2b-256 201310883a77940a8db08cd24ea4681361dece1d91621cb4a846b7d4fd6abb0b

See more details on using hashes here.

File details

Details for the file tfpy-0.6.0-py3-none-any.whl.

File metadata

  • Download URL: tfpy-0.6.0-py3-none-any.whl
  • Upload date:
  • Size: 7.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.0.9 CPython/2.7.17 Linux/5.3.0-1028-azure

File hashes

Hashes for tfpy-0.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 85338cab61261894c0ae7a81abed8cadd1f6d702ec37a2e546f7f3a78c274fcd
MD5 145cc699979ae83af34dbda5b3c19312
BLAKE2b-256 d5f75d5dd76b82e0e3673255973ebe67b4c067edae595109d125a613c063fb6c

See more details on using hashes here.

Supported by

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