Terrapyst
Terrapyst is a Python wrapper around the Terraform CLI.
Usage
Quick Start
Terrapyst usage centers around the Workspace object, which can be used to run the typical Terraform commands in that workspace. Just like with the CLI you have to initialize the workspace before you can run plans or applies.
from terrapyst import Workspace
workspace = Workspace(path="./")
workspace.init()
results, plan = workspace.plan()
if !results.successful:
raise Exception(f"Terraform run failed without output: {results.stdout}")
if plan.deletions > 0:
raise Exception("Deletions not expected from this plan")
results, apply_log = workspace.apply(plan_path=plan.plan_path, auto_approve=True)
if !results.successful:
print("Terraform Apply was not successful.")
for resource_name, resource_data in apply_log.resources.items():
print(f"${resource_name}: ${resource['message']}")
for output_name, output_data in apply_log.outputs.items():
print(f"{output_name}:\n")
print(yaml.dumps(output_data))
print("\n\n\n")
The plan step can be skipped if you are auto approving.
from terrapyst import Workspace
workspace = Workspace(path="./")
workspace.init()
results, apply_log = workspace.apply(auto_approve=True)
Installation
Terrapyst can be installed with pip.
pip install terrapyst
In addition to Terrapyst you should have the Terraform binary installed on your system.
Metadata
Release files for terrapyst 0.4.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| terrapyst-0.4.1.tar.gz | 10.5 kB | Without provenance | Details for terrapyst-0.4.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| terrapyst-0.4.1-py3-none-any.whl | Python 3 | none | any | Details for terrapyst-0.4.1-py3-none-any.whl |
Total release size: 23.1 kB
Release files / terrapyst-0.4.1.tar.gz
| Download URL | terrapyst-0.4.1.tar.gz |
|---|---|
| Size | 10.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
bc85d57a9fd1b3752c34b688df07ea45c815cd3e9049a3b769a469eacf9c4ed4
|
|
BLAKE2b-256 checksum How to use checksums |
06c8a83a5187b96f8827b2997be083cb06136bb5366bd528fd5b0879ccee3e5f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.15
|
Release files / terrapyst-0.4.1-py3-none-any.whl
| Download URL | terrapyst-0.4.1-py3-none-any.whl |
|---|---|
| Size | 12.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1b26681eb68c66cd4d2998ac2848e3099a2bab92b1b3dc9a611e1846e84f21c9
|
|
BLAKE2b-256 checksum How to use checksums |
9930a9cbc8c805ceb01dc0545e42b76ab3643cff8aea96a1fcbc1d56654a01ac
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.15
|
Security for terrapyst 0.4.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.