Example components for the Pyvider Terraform provider framework
This repository provides a standard set of example components for the Pyvider framework, demonstrating how to build Terraform providers in Python.
- π Learning Resources - Real-world examples of Pyvider components
- π§ Reusable Components - Data sources, resources, and functions ready to use
- π§ͺ Test Patterns - Reference implementations for provider testing
- ποΈ Build Templates - Fork and customize for your own providers
- Install:
uv add pyvider-components - Read the Documentation
- Explore Examples
To use the pyvider-components provider, configure it in your Terraform project:
terraform {
required_providers {
pyvider = {
source = "local/providers/pyvider"
version = ">= 0.0.0" # For development/learning
# For specific versions: version = "~> 0.1"
}
}
}
provider "pyvider" {
# Provider configuration options go here
}# Set up environment
uv sync
# Run common tasks
we run test # Run tests
we run lint # Check code
we run format # Format code
we tasks # See all available commandsSee CLAUDE.md for detailed development instructions and architecture information.
pytestSee CONTRIBUTING.md for contribution guidelines.
See LICENSE for license details.
pyvider-components is a learning and reference library that demonstrates how to build Terraform provider components using the Pyvider framework. It contains working examples of resources, data sources, and functions that you can:
- π Learn from - See real-world examples of Pyvider components
- π Reference - Use as templates for your own providers
- π§ͺ Test with - Try out Pyvider features without writing code
- ποΈ Build on - Fork and customize for your needs
Note: This is primarily an example/learning library, not a production provider. For production use, the terraform-provider-pyvider packages these components into a deployable provider.
βββββββββββββββββββββββββββ
β pyvider (framework) β β Core framework for building providers
βββββββββββββ¬ββββββββββββββ
β
βββββββββββββββββββββββββββββββββββββββ
β β
βββββββββββββΌββββββββββββββ βββββββββββββββββΌβββββββββββββββ
β pyvider-components ββββββΆβ terraform-provider-pyvider β
β (example library) β β (pre-release/testing provider) β
β β β β
β β’ Learning resources β β β’ Uses components from β β
β β’ Reference examples β β β’ Packaged & tested β
β β’ Component demos β β β’ Pre-release learning tool β
βββββββββββββββββββββββββββ ββββββββββββββββββββββββββββββββ
Key Difference:
- pyvider-components: Learn how to build components (this repo)
- terraform-provider-pyvider: Pre-release provider for testing and learning (terraform-provider-pyvider)
Use this repository when you want to:
β Learn how to build Pyvider providers β See working examples of resources, data sources, and functions β Experiment with Pyvider features β Reference implementation patterns β Build your own custom provider
Use the provider when you want to:
β Learn and experiment with Pyvider in Terraform β Test provider functions and resources β Follow a getting started tutorial β Build sample configurations
This project is part of a larger ecosystem of tools for Python and Terraform development.
Understand how provide-foundation, pyvider, flavorpack, and other projects work together.
pyvider_env_variables: Provides access to environment variables.pyvider_file_info: Provides metadata about a file or directory.pyvider_http_api: Makes an HTTP request and returns the response.pyvider_lens_jq: Transforms data using a JQ expression.
pyvider_file_content: Manages the content of a file.pyvider_local_directory: Manages a directory on the local filesystem.pyvider_private_state_verifier: Verifies the private state of a resource (for testing).pyvider_timed_token: Manages a short-lived token (for testing).pyvider_warning_example: Demonstrates how to return warnings (for testing).
A rich set of utility functions are provided for common data manipulations.
- Numeric:
add,subtract,multiply,divide,sum,min,max,round - String:
upper,lower,split,join,replace,format,truncate,format_size,pluralize,to_snake_case,to_kebab_case,to_camel_case - Collection:
length,contains,lookup - Type Conversion:
tostring - Transformation:
lens_jq
data "pyvider_env_variables" "shell" {
keys = ["SHELL"]
}
output "shell_path" {
value = data.pyvider_env_variables.shell.values["SHELL"]
}resource "pyvider_file_content" "example" {
filename = "/tmp/example.txt"
content = "This file is managed by Terraform."
}
output "file_hash" {
value = pyvider_file_content.example.content_hash
}output "uppercase_example" {
value = provider::pyvider::upper("hello world")
}Copyright (c) provide.io LLC.