Skip to main content

Documentation generation system for Terraform/OpenTofu providers

Project description

๐Ÿฝ๏ธ Plating

A sophisticated documentation generation system for Terraform/OpenTofu providers

Plating is a powerful documentation system that brings culinary elegance to technical documentation. Just as a chef carefully plates a dish, Plating helps you present your Terraform provider documentation beautifully.

โœจ Features

  • ๐ŸŽฏ Automatic Documentation Generation - Generate comprehensive docs from your provider code
  • โœจ Smart Component Adorning - Automatically create documentation templates for undocumented components
  • ๐Ÿฝ๏ธ Beautiful Plating - Render documentation with examples, schemas, and rich formatting
  • ๐Ÿ” Component Discovery - Automatically find and document resources, data sources, and functions
  • ๐Ÿ“ Jinja2 Templates - Flexible templating with custom functions and filters
  • ๐Ÿ”„ Schema Integration - Extract and format provider schemas automatically
  • ๐ŸŽฏ Capability-First Organization - Group documentation by feature (Math, Utilities, Lens) instead of just type
  • ๐Ÿ“ Smart Navigation - Auto-generated mkdocs.yml with capability-first structure
  • ๐Ÿ“š Guide Support - Built-in support for provider guides and tutorials

๐Ÿ“ฆ Prerequisites

Important: This project uses uv for Python environment and package management.

Install UV

Visit UV Documentation for more information.

# On macOS and Linux.
curl -LsSf https://astral.sh/uv/install.sh | sh

# On Windows.
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"

# Using pipx (if you prefer)
pipx install uv

# Update UV to latest version
uv self update

๐Ÿš€ Getting Started

Installation

Note: Plating is currently in pre-release. Install from source for now.

Version Info: The version 0.0.1000-0 is a pre-release identifier indicating active development. Expect the API and features to evolve as the project matures.

# Clone the repository
git clone https://github.com/provide-io/plating.git
cd plating

# Create virtual environment
uv venv

# Activate virtual environment
source .venv/bin/activate  # On Linux/macOS
# or
.venv\Scripts\activate     # On Windows

# Install dependencies
uv sync

Coming soon to PyPI:

# PyPI installation (not yet available)
# uv add plating

Quick Install from Git

# Install directly from GitHub
uv add git+https://github.com/provide-io/plating.git

๐Ÿ“š Usage Examples

1. Adorn Your Components

First, create .plating bundles for your undocumented components:

# Adorn all missing components
plating adorn

# Adorn only resources
plating adorn --component-type resource

2. Customize Templates

Edit the generated templates in .plating/docs/:

---
page_title: "Resource: my_resource"
---

# my_resource

{{ "{{ example('basic') }}" }}

## Schema

{{ "{{ schema() }}" }}

3. Generate Documentation

Render your documentation:

# Generate docs in ./docs directory
plating plate

# Custom output directory
plating plate --output-dir ./documentation

๐Ÿ“‚ Bundle Structure

Each component has a .plating bundle:

my_resource.plating/
โ”œโ”€โ”€ docs/
โ”‚   โ”œโ”€โ”€ my_resource.tmpl.md    # Main template
โ”‚   โ””โ”€โ”€ _partial.md             # Reusable partials (optional)
โ”œโ”€โ”€ examples/
โ”‚   โ”œโ”€โ”€ basic.tf                # Example configurations
โ”‚   โ”œโ”€โ”€ advanced.tf             # (optional)
โ”‚   โ””โ”€โ”€ full_stack/             # Grouped examples (optional)
โ”‚       โ””โ”€โ”€ main.tf             # Required entry point
โ””โ”€โ”€ fixtures/                   # Test fixtures (optional)
    โ””โ”€โ”€ data.json               # Test data files

Note: The examples/ directory can contain:

  • .tf files for resources/data sources (flat examples)
  • .py files for Python API examples
  • Subdirectories with main.tf for grouped examples that combine multiple components

๐ŸŽจ Template Functions

Plating provides powerful template functions:

  • {{ "{{ schema() }}" }} - Render component schema as markdown table
  • {{ "{{ example('name') }}" }} - Include an example file in a terraform code block
  • {{ "{{ include('filename') }}" }} - Include a static partial file
  • {{ "{{ render('filename') }}" }} - Render a dynamic template partial with current context

๐ŸŽฏ Capability-First Organization

Plating now supports organizing documentation by capability (subcategory) instead of just by component type. This makes it easier to find related functionality across resource types.

How It Works

  1. Add Subcategory to Templates

    Add a subcategory field to your component template frontmatter:

    ---
    page_title: "sqrt Function"
    subcategory: "Math"
    description: |-
      Calculate square root of a number
    ---
    
  2. Automatic Organization

    Components are automatically grouped by capability in generated documentation:

    ## Math
    ### Functions
    - add
    - subtract
    - multiply
    
    ## String Utilities
    ### Functions
    - format
    - join
    - split
    
    ## Utilities
    ### Resources
    - pyvider_file_content
    ### Data Sources
    - pyvider_env_variables
    
  3. MkDocs Navigation

    The mkdocs.yml navigation is automatically generated with capability-first structure:

    nav:
      - Overview: index.md
      - Math:
          Functions:
            add: functions/add.md
            subtract: functions/subtract.md
      - String Utilities:
          Functions:
            format: functions/format.md
            join: functions/join.md
      - Utilities:
          Resources:
            file_content: resources/file_content.md
    

Standard Subcategories

  • Math - Numeric operations (add, subtract, multiply, etc.)
  • String Utilities - String manipulation (format, join, split, etc.)
  • Collections - List/map operations (contains, length, lookup)
  • Type Conversion - Type casting functions
  • Lens - Data transformation components (JQ integration)
  • Utilities - General-purpose resources and data sources
  • Test Mode - Components for testing (always appears last)

Custom Subcategories

You can use any custom subcategory name. Just add it to your template frontmatter:

---
page_title: "Custom Component"
subcategory: "My Custom Category"
---

Guide Support

Add provider-level guides in .plating/guides/:

.plating/
โ”œโ”€โ”€ guides/
โ”‚   โ”œโ”€โ”€ getting-started.tmpl.md
โ”‚   โ”œโ”€โ”€ authentication.tmpl.md
โ”‚   โ””โ”€โ”€ troubleshooting.tmpl.md
โ””โ”€โ”€ docs/
    โ””โ”€โ”€ components.tmpl.md

Guides are automatically discovered and added to the documentation structure and navigation.

๐Ÿ” Validation

Validate your generated documentation:

# Validate all documentation
plating validate

# Validate in custom directory
plating validate --output-dir ./documentation

๐Ÿ›ก๏ธ Foundation Integration

Plating is built on provide.foundation patterns for enterprise-grade reliability:

  • ๐Ÿ”„ Automatic Retries: Built-in retry policies with exponential backoff for I/O operations
  • ๐Ÿ“Š Metrics & Observability: Integrated performance tracking and operation metrics
  • โšก Circuit Breakers: Prevents cascading failures in distributed systems
  • ๐Ÿ“ Structured Logging: Foundation logger integration with contextual information
  • ๐Ÿš€ Async-First Design: High-performance async operations throughout

๐Ÿ”ง Advanced Usage

Filter to Specific Package

By default, Plating searches all installed packages for components. You can filter to a specific package:

plating adorn --package-name pyvider.components
plating plate --package-name pyvider.components

Generate Executable Examples

Generate standalone executable Terraform examples alongside documentation:

plating plate --generate-examples

Customize example output directories:

plating plate --generate-examples \
  --examples-dir examples/ \
  --grouped-examples-dir examples/integration/

๐Ÿ”ง Configuration

Configure Plating in your pyproject.toml:

[tool.plating]
# Provider name (auto-detected if not specified)
provider_name = "my_provider"

Note: Currently only provider_name can be configured in pyproject.toml. Other options like output_dir and component_types must be passed as CLI flags:

plating plate --output-dir docs --component-type resource

๐Ÿ—๏ธ Architecture

Plating follows a modular architecture:

  • PlatingBundle - Represents documentation bundles
  • PlatingPlater - Renders documentation
  • PlatingAdorner - Creates documentation templates
  • PlatingDiscovery - Finds components and bundles
  • SchemaProcessor - Extracts provider schemas

๐Ÿค Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

๐Ÿ“œ License

Apache 2.0

๐Ÿ™ Acknowledgments

Built with โค๏ธ using:

  • attrs - Python classes without boilerplate
  • Jinja2 - Powerful templating
  • pyvider - Terraform provider framework
  • click - Command line interface
  • rich - Beautiful terminal output

Plating - Making documentation as delightful as a well-plated dish ๐Ÿฝ๏ธ

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

plating-0.0.1100.tar.gz (105.7 kB view details)

Uploaded Source

Built Distribution

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

plating-0.0.1100-py3-none-any.whl (103.9 kB view details)

Uploaded Python 3

File details

Details for the file plating-0.0.1100.tar.gz.

File metadata

  • Download URL: plating-0.0.1100.tar.gz
  • Upload date:
  • Size: 105.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.7

File hashes

Hashes for plating-0.0.1100.tar.gz
Algorithm Hash digest
SHA256 b2534128fa5c28597da39b72ca71ca125bf6bbed9897ee740465e0b796b651ad
MD5 5d2c1a3701e3a2bb52bd2c7fef0493b1
BLAKE2b-256 f83ea0c94ace7e0ebb51647d5cb69e2ac41455ad4b5f97a6236cefc1a0a35b9c

See more details on using hashes here.

File details

Details for the file plating-0.0.1100-py3-none-any.whl.

File metadata

  • Download URL: plating-0.0.1100-py3-none-any.whl
  • Upload date:
  • Size: 103.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.7

File hashes

Hashes for plating-0.0.1100-py3-none-any.whl
Algorithm Hash digest
SHA256 6cdfae8fa94ab3ccdd433996b12b2d1656b53b14996ac76e66d11dbc3eccf6c3
MD5 18287cf01a92280ac36e181a1ad32dee
BLAKE2b-256 6993564d45ab53e1684c50e40edf82b819cc7c0f8e96101efae055610a29d5c1

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