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-1.0.0.tar.gz (3.8 kB view details)

Uploaded Source

Built Distribution

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

terrastack-1.0.0-py3-none-any.whl (3.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: terrastack-1.0.0.tar.gz
  • Upload date:
  • Size: 3.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.1

File hashes

Hashes for terrastack-1.0.0.tar.gz
Algorithm Hash digest
SHA256 24b608f9f4de8773496057c421a028ddf0efe44b8379392fafa7adefad51f489
MD5 dfccd856a53899161b22b6f6753d8cf4
BLAKE2b-256 80312f1742943b9d061f902d3d127b0707e6c73b168f24562862a9b873ad3b44

See more details on using hashes here.

File details

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

File metadata

  • Download URL: terrastack-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 3.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.1

File hashes

Hashes for terrastack-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5fb38d4184414b4751aa1b03a82a2c5ab479b8f5c096456f654cf89adb53dbb2
MD5 416e105bf001ee4167127d77ec5ae191
BLAKE2b-256 f0de2031a06173a41d3e8c64d511b9a342b15f68d7866cf516e87eb02bfdbf4c

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