cloud-custodian/pytest-terraform

pytest terraform plugin with fixtures and offline replay support

Hosted by Cloud Native Computing Foundation · part of Linux Foundation

View on GitHub ↗Jump to charts ↓

cloud-custodian/pytest-terraform has 50+ stars and 10+ forks on GitHub, is written in Python, and was last pushed on Apr 8, 2026. Data as of . Signed-in members get hourly updates — create a free account.

Summary Information

Updated 2 minutes ago
Added to GitGenius on October 15th, 2026
Created on April 17th, 2020
Open Issues & Pull Requests: 6 (+0)
GitHub issues: Enabled
Number of forks: 18
Total Stargazers: 59 (+0)
Total Subscribers: 6 (+0)

Repository Insights (GitGenius)

Most active contributors

Sign in to see contributor activity.
Sign in

Related repositories by overlapping contributors

No overlapping-contributor repos identified yet.

Charts & Analytics

Fetching additional details & charts...

Issue Activity (beta)

Open issues: 0
New in 7 days: 0
Closed in 7 days: 0
Avg open age: N/A days
Stale 30+ days: 0
Stale 90+ days: 0

Recent activity

Opened in 7 days: 0
Closed in 7 days: 0
Comments in 7 days: 0
Events in 7 days: 0

Top labels

No label distribution available yet.

Most active issues this week

Sign in to see which issues are moving.
Sign in

Detailed Description

pytest-terraform is a pytest plugin that enables provisioning infrastructure via Terraform as a fixture within unit and functional tests.

The plugin solves the problem of integrating Terraform-based infrastructure provisioning into test suites by providing a decorator-based fixture factory pattern. Tests can reference Terraform modules through a `terraform` decorator that accepts parameters for the module directory, fixture scope, teardown behavior, and fixture naming. The plugin automatically discovers Terraform modules in standard locations relative to test files or in an explicitly specified directory. It supports three teardown modes: always destroy resources, destroy while ignoring failures, or skip teardown entirely.

The tool suits projects that need to validate infrastructure code or test applications against real or simulated infrastructure. It is particularly valuable for teams already using pytest and Terraform together. The plugin's replay mode, enabled by default, allows tests to run against recorded resource snapshots rather than invoking Terraform each time, enabling faster test execution and offline testing. Tests using Terraform fixtures are automatically marked so they can be selected and run separately from other tests. Developers can provide an explicit path to the Terraform binary or let the plugin auto-discover it. The plugin also provides pytest hooks, specifically `pytest_terraform_modify_state`, that can be implemented in conftest.py files to customize behavior.

The project maintains active engagement with its codebase through regular updates and refinements to its core functionality. Development includes ongoing work to expand scope support beyond the fully tested function and session scopes. The maintainers actively document edge cases and provide clear guidance on when specific features like the OFF teardown mode should be used. The project demonstrates responsiveness to practical testing scenarios, such as supporting tests that perform destructive actions against provisioned resources.