Skip to main content

Standard Components for the Pyvider Framework

Project description

Pyvider Components

This repository provides a standard set of components for the Pyvider framework, a Python-based framework for building Terraform providers.

Components

The following components are available:

Data Sources

  • pyvider_env_variables: Provides access to environment variables.
  • pyvider_file_info: Provides information about a file.
  • pyvider_http_api: Makes an HTTP request and returns the response.
  • pyvider_lens_jq: Transforms data using a JQ expression.

Resources

  • 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.
  • pyvider_timed_token: Manages a timed token.
  • pyvider_warning_example: An example resource that demonstrates how to return warnings.

Functions

Numeric Functions

  • add: Adds two numbers.
  • subtract: Subtracts two numbers.
  • multiply: Multiplies two numbers.
  • divide: Divides two numbers.
  • sum: Sums a list of numbers.
  • min: Returns the minimum of a list of numbers.
  • max: Returns the maximum of a list of numbers.
  • round: Rounds a number to specified precision.

String Functions

  • upper: Converts a string to uppercase.
  • lower: Converts a string to lowercase.
  • split: Splits a string into a list of strings.
  • join: Joins a list of strings.
  • replace: Replaces a substring in a string.
  • format: Formats a string using positional arguments.
  • truncate: Truncates text to specified length.
  • format_size: Formats bytes as human-readable size.
  • pluralize: Pluralizes a word based on count.
  • to_snake_case: Converts a string to snake_case.
  • to_kebab_case: Converts a string to kebab-case.
  • to_camel_case: Converts a string to camelCase.

Collection Functions

  • length: Returns the length of a string, list, or map.
  • contains: Checks if a list contains a given element.
  • lookup: Looks up a value in a map.

Type Conversion Functions

  • tostring: Converts any value to a string.

Transformation Functions

  • lens_jq: Transforms data using a JQ expression.

Getting Started

To use the pyvider-components provider, you need to configure it in your Terraform project.

terraform {
  required_providers {
    pyvider = {
      source  = "local/providers/pyvider"
      version = "0.1.0"
    }
  }
}

provider "pyvider" {
  # Configuration options here
}

Examples

Here are a few examples of how to use the components:

pyvider_env_variables

# Filter by a specific list of keys
data "pyvider_env_variables" "by_keys" {
  keys = ["TEST_VAR1", "TEST_VAR2", "TEST_SENSITIVE_TOKEN", "NON_EXISTENT_VAR"]
}

output "by_keys_result" {
  description = "Result of filtering by specific keys."
  value       = data.pyvider_env_variables.by_keys.values
}

pyvider_file_content

# Create file
resource "pyvider_file_content" "test_create" {
  filename = "/tmp/pyvider_test_create.txt"
  content  = "This is a test file created by Pyvider"
}

output "created_file" {
  value = {
    filename = pyvider_file_content.test_create.filename
    content = pyvider_file_content.test_create.content
    exists = pyvider_file_content.test_create.exists
    content_hash = pyvider_file_content.test_create.content_hash
  }
}

upper function

output "upper_result" {
  value = provider::pyvider::upper("hello world")
}

Development

To contribute to the development of the pyvider-components provider, you need to set up the development environment.

Environment Setup

# Set up the development environment (creates virtual env, installs dependencies)
uv sync

Testing

# Run all tests
pytest

Building

# Build the package
uv build

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

pyvider_components-0.0.1026.tar.gz (148.2 kB view details)

Uploaded Source

Built Distribution

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

pyvider_components-0.0.1026-py3-none-any.whl (195.3 kB view details)

Uploaded Python 3

File details

Details for the file pyvider_components-0.0.1026.tar.gz.

File metadata

File hashes

Hashes for pyvider_components-0.0.1026.tar.gz
Algorithm Hash digest
SHA256 29e9c4f50002c4ca7533b9b0ceaa1cb8f44ee3c19a21442ca6e8686fb333ea99
MD5 d454bdda8a779f738d0ee6e5c711ff6f
BLAKE2b-256 62a82b3bb8b7220da50c3c9ff685cb3a9fb6a5f2bb875bf59ea3a6734ef09679

See more details on using hashes here.

File details

Details for the file pyvider_components-0.0.1026-py3-none-any.whl.

File metadata

File hashes

Hashes for pyvider_components-0.0.1026-py3-none-any.whl
Algorithm Hash digest
SHA256 f9c4988845f004e3b3b9f11b73fb299314a66c2ef533902ba49ff38749b7d050
MD5 cb6d370fb6286fcaec4a98a855e9995e
BLAKE2b-256 f26ed52a157675a37e103f27b1301ba9c9f19787bda0ce79045e42841d24983d

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