Skip to main content

Create terraform specifications with code

Project description

Terrastack

This simple project provides a way to define terrastack specifications through the Python language, which in turn can be used to output Terraform json specifications.

The library itself does not try to create abstractions for every type of resource and attribute that can be defined in Terraform. The goal for the API is to be as thin as possible - with the help of using standard python objects and kwarg handling. Sacrificing type safety in order to be feature compatible with Terraform.

Example use:

import terrastack as ts

stack = ts.Stack()
stack.extend(ts.Provider("aws",
    region  = "eu-west-1",
    version = "1.30.0",
))

# extend supports variable number of components
stack.extend(
    ts.Resource("aws_instance", "my-instance-1",
        ami="some-ami",
    ),
    ts.Resource("aws_instance", "my-instance-2",
        ami="some-ami",
    ),
    ts.Output("my-output", "some_value"),
)

print(stack.render_json())

# output:
        {
            "output": {
                "value": "some_value"
            },
            "provider": [
                {
                    "aws": {
                        "region": "eu-west-1",
                        "version": "1.30.0"
                    }
                }
            ],
            "resource": {
                "aws_instance": {
                    "my-instance-1": {
                        "ami": "some-ami"
                    },
                    "my-instance-2": {
                        "ami": "some-ami"
                    }
                }
            }
        }

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

terrastack-0.3.0.tar.gz (3.9 kB view details)

Uploaded Source

Built Distribution

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

terrastack-0.3.0-py3-none-any.whl (3.1 kB view details)

Uploaded Python 3

File details

Details for the file terrastack-0.3.0.tar.gz.

File metadata

  • Download URL: terrastack-0.3.0.tar.gz
  • Upload date:
  • Size: 3.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/39.2.0 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/3.6.5

File hashes

Hashes for terrastack-0.3.0.tar.gz
Algorithm Hash digest
SHA256 68361b99f3b3b1bcddc6a5c9134b7f2432a6d44d763e62a6548cd6f9c1da291c
MD5 5574a214cc03429d5ba1894f7a421f61
BLAKE2b-256 c6517391ed30d62ad9e457f7f275a43fa499f8f1d46cf5a9cff4040ca6f9c686

See more details on using hashes here.

File details

Details for the file terrastack-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: terrastack-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 3.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/39.2.0 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/3.6.5

File hashes

Hashes for terrastack-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 41ffd3edfc87cb91bddad77416771c61b735bef0d456f4163338f8f91c3c9a1c
MD5 d1d5f7d8c9efc07f2a3252a5efd52942
BLAKE2b-256 5ed7dbfe90e1bcdaac8e37ef89240aff88309f96e9c37045e0e7c74545bc85c5

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