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": {
                "my_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.4.0.tar.gz (4.0 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.4.0-py3-none-any.whl (3.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: terrastack-0.4.0.tar.gz
  • Upload date:
  • Size: 4.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.27.0 CPython/3.7.0

File hashes

Hashes for terrastack-0.4.0.tar.gz
Algorithm Hash digest
SHA256 6d070fdb7357a4d17f91ff7927a9314b857a8e7837098ec60191a690ed2410f4
MD5 a9a281cf683c7077af640aaf084b21a5
BLAKE2b-256 b9a20d8fd8a5e8b0be1bfcd0fc5bf8fab48f7de1264f2fa88d76ca87b5345613

See more details on using hashes here.

File details

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

File metadata

  • Download URL: terrastack-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 3.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.27.0 CPython/3.7.0

File hashes

Hashes for terrastack-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9a8998acb919a1fa0bac558f7a848d3b13129a3672698557eac124a8ba8aa6a1
MD5 686d4fc5c8cccff44a2a810fb0f8bc1f
BLAKE2b-256 b3d02fbb4add2251572524715d421a6dbc4c069d5c6dae08bc945f02e8e3bc81

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