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

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for terrastack-0.2.0.tar.gz
Algorithm Hash digest
SHA256 62c6a4cc0730861502c96286e537acf665849185712f4b3f1b394e8b1a15b452
MD5 a47597d3a5fecb148e405daaa6a6f71c
BLAKE2b-256 48d14c3c083cc03196e294bc5aa75e4ec62bd58838c6e516efb1125556454b66

See more details on using hashes here.

File details

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

File metadata

  • Download URL: terrastack-0.2.0-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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a9a6b99c434f909ffecf4b101a45a64fd934f4cb1b1093f8cfc90de3de302a05
MD5 24f5a5f860deb6fab2c7f41b53a338a5
BLAKE2b-256 7c492e7d6cba349c6bb9dc9cf65c62e9a7484da925697cc0ab82293de9331c2d

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