Skip to main content

A Python wrapper for Terraform

Project description

TerraWeave: A Python Wrapper for Terraform

TerraWeave is a Python library that provides a simple interface for interacting with Terraform. It wraps common Terraform commands such as init, plan, apply, destroy, and workspace management, making it easier to integrate Terraform into Python-based workflows.

Features

  • Initialize a Terraform working directory (terraform init).
  • Generate and show execution plans (terraform plan).
  • Apply changes to reach the desired state (terraform apply).
  • Destroy Terraform-managed infrastructure (terraform destroy).
  • Retrieve Terraform output variables (terraform output).
  • Manage Terraform workspaces:
    • List workspaces (terraform workspace list).
    • Show the current workspace (terraform workspace show).
    • Create a new workspace (terraform workspace new).
    • Select a workspace (terraform workspace select).
    • Delete a workspace (terraform workspace delete).

Installation

Pip

pip install TerraWeave

From source

Clone the repository to your local machine:

git clone https://github.com/brains93/TerraWeave.git
cd TerraWeave

Ensure you have Python 3.7+ installed, along with Terraform installed and available in your system's PATH.

Usage Example: Basic Usage

NOTE: the class uses python logging to print the output to stdout, this can be redirectedto a file using the same logging library

from TerraWeave import TerraformWrapper

# Path to the directory containing Terraform configuration files
working_dir = "/path/to/terraform/config"

# Initialize the TerraformWrapper
tf = TerraformWrapper(working_dir)

# Initialize Terraform
print("Initializing Terraform...")
tf.init()

# Generate a plan
print("Generating Terraform plan...")
tf.plan()

# Apply the changes
print("Applying Terraform changes...")
tf.apply()

# Destroy the infrastructure
print("Destroying Terraform-managed infrastructure...")
tf.destroy()

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

terraweave-0.1.1.tar.gz (3.0 kB view details)

Uploaded Source

Built Distribution

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

terraweave-0.1.1-py3-none-any.whl (2.8 kB view details)

Uploaded Python 3

File details

Details for the file terraweave-0.1.1.tar.gz.

File metadata

  • Download URL: terraweave-0.1.1.tar.gz
  • Upload date:
  • Size: 3.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for terraweave-0.1.1.tar.gz
Algorithm Hash digest
SHA256 0d3dab25674faaa8bedd6726a415dd321d20eb4217b5d960830f6f722d4a07c6
MD5 358ebc2cc3756dbe89f1df38816f32f8
BLAKE2b-256 d2e2517b99363a061cbe1e3d8f49571fddcc7de902605ff7ac9695d2c8f09d4c

See more details on using hashes here.

File details

Details for the file terraweave-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: terraweave-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 2.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for terraweave-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a0599b5045550faf23bb5888962f1c9de8f155a46c1d53dd4efe8e21cc30d33b
MD5 29d9c5b1c9c9fa0ed0cb70b93a1513a0
BLAKE2b-256 122e2f1541f7ddd5403aa736d2bad0f232725ffbe8c4f56889c2bd93e607c32a

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