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.2.1.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.2.1-py3-none-any.whl (3.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: terrastack-0.2.1.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/40.0.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.6.5

File hashes

Hashes for terrastack-0.2.1.tar.gz
Algorithm Hash digest
SHA256 ca1409a3816caabf2b110f40e2bf31c539b89a04b8f3d66a201fdb249a9f868d
MD5 59ee78449ec137e3b6b0d0a82a272ff6
BLAKE2b-256 bba4aad46a7398c057b0fc9f949d9ed6e08129e447b3685f3d615f428edb17e4

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for terrastack-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 81eecec74278f9126dd386092703ec691308e25fcc6692a5f7ce1aaa94c1f12f
MD5 e4c1baab7d541cf1fe57fad753267219
BLAKE2b-256 cb4528643f67587d0cdac4a32e12765d1d360d8dac0a6232929e6bad003b0d50

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