terraform-plugin-testing
github.com
What it is
terraform-plugin-testing is a free Go helper module for testing Terraform providers on Linux and macOS. It supports unit tests that exercise plugin code in isolation without network connections, and acceptance tests that run real Terraform plan, apply, refresh, and destroy operations. Acceptance testing includes Lifecycle, Import, Refresh, and Query modes. The plancheck package can inspect empty or non-empty plans, resource and data source values, and actions. The statecheck package checks known values, sensitive values, and comparisons between resource or data source attributes. The framework uses a local Terraform binary with standard Go testing tools, including go test and the testing package, so tests can run in continuous integration environments such as GitHub Actions. Acceptance runs may create and destroy infrastructure, which can consume quotas and incur expenses. Prerequisites include a recent stable Go release, Terraform CLI 0.12.26 or later, provider and resource access, and TF_ACC set to a value. The project uses Mozilla Public License v2.0.
Spec sheet
- Purpose
- terraform-plugin-testing is a Go helper module for testing Terraform providers.Read 3 Oct 2026 · github.com
- License
- The project is licensed under Mozilla Public License v2.0.Read 3 Oct 2026 · github.com
- Acceptance prerequisites
- Acceptance tests require a recent stable Go version, Terraform CLI 0.12.26 or later, access to the provider and tested resources, and TF_ACC set to a value.Read 3 Oct 2026 · developer.hashicorp.com
- Acceptance tests
- Acceptance tests run real Terraform plan, apply, refresh, and destroy operations and let developers assert their outcomes.Read 3 Oct 2026 · developer.hashicorp.com
- CI use
- Acceptance tests can run in any environment capable of running go test, including a continuous integration runner such as GitHub Actions.Read 3 Oct 2026 · developer.hashicorp.com
- Go compatibility
- The repository states that the two latest major Go releases are supported and currently requires Go 1.25 or later as a dependency.Read 3 Oct 2026 · github.com
- Infrastructure costs
- Acceptance tests can create and destroy real infrastructure, which may incur expenses and consume quotas.Read 3 Oct 2026 · developer.hashicorp.com
- Plan checks
- The plancheck package includes checks for empty or non-empty plans and for resource or data source values and actions.Read 3 Oct 2026 · developer.hashicorp.com
- Security reporting
- The repository asks vulnerability reporters to email [email protected] and include reproduction steps, relevant tools and versions, and tool output.Read 3 Oct 2026 · github.com
- State checks
- The statecheck package includes checks for known values, sensitive values, and comparisons between resource or data source attributes.Read 3 Oct 2026 · developer.hashicorp.com
- Terraform integration
- The framework uses a local Terraform binary and standard Go testing features including go test and the testing package.Read 3 Oct 2026 · developer.hashicorp.com
- Test modes
- Acceptance tests support Lifecycle, Import, Refresh, and Query modes.Read 3 Oct 2026 · developer.hashicorp.com
- Unit tests
- Unit tests can test plugin code in isolated units without network connections.Read 3 Oct 2026 · developer.hashicorp.com
Plans and prices
Strong points and limits
Strong points
- Free Go module for Terraform provider testing
- Supports unit and real infrastructure acceptance tests
- Lifecycle, Import, Refresh, and Query modes
- Plan and state assertion packages
- Runs with standard go test tooling
Limits
- Acceptance tests can incur infrastructure expenses
- Acceptance tests require Terraform CLI 0.12.26 or later
- Requires a recent stable Go version and TF_ACC
- Linux and macOS platforms listed
Who it suits
It suits Go developers building or maintaining Terraform providers, including teams running provisioning checks in CI/CD. It is also relevant when tests need either isolated plugin checks or real infrastructure operations.
Verdict
terraform-plugin-testing covers both isolated provider checks and acceptance workflows against a local Terraform binary. Its infrastructure-running tests require careful quota and cost planning, while its free plan keeps the module itself available without a listed charge.
Where Specifiction places it
- Infrastructure Testing Tools#21 of 287.2