terraform-plugin-testing
github.com
- Free plan
- macOS
- Linux
What terraform-plugin-testing is
terraform-plugin-testing is a free Go helper module for testing Terraform providers. It supports isolated unit tests without network connections and acceptance tests that run real Terraform plan, apply, refresh, and destroy operations. Acceptance tests offer Lifecycle, Import, Refresh, and Query modes. The plancheck package checks empty or non-empty plans, resource and data source values, and actions. The statecheck package checks known and sensitive values and compares resource or data source attributes. The framework uses a local Terraform binary and standard Go testing tools, including go test. Tests can run in continuous integration environments such as GitHub Actions. Acceptance tests may create and destroy real infrastructure, consuming quotas and potentially incurring expenses. Requirements include 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. The repository states that the two latest major Go releases are supported and currently requires Go 1.25 or later as a dependency. The project is licensed under Mozilla Public License v2.0.
Who it suits
It suits Go developers building or maintaining Terraform providers who need unit, plan, state, and real infrastructure acceptance checks. Teams can run it locally or in CI environments that support go test.
Good to know, and what to watch
- Free open-source Go testing module
- Unit tests can run without network access
- Acceptance tests cover Terraform lifecycle operations
- Plan and state assertion packages
- Works in continuous integration runners
- Acceptance tests can incur infrastructure expenses
- Requires Terraform CLI 0.12.26 or later
- Currently requires Go 1.25 or later
- Acceptance tests need TF_ACC configured
Plans
Every plan and priceOpen source
Free plan
The verdict
terraform-plugin-testing provides focused unit, plan, state, and acceptance testing for Terraform providers. Its real infrastructure tests are useful but require suitable Terraform, Go, provider access, and cost controls.
What the maker publishes
- 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. source
- Acceptance tests
- Acceptance tests run real Terraform plan, apply, refresh, and destroy operations and let developers assert their outcomes. source
- CI use
- Acceptance tests can run in any environment capable of running go test, including a continuous integration runner such as GitHub Actions. source
- 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. source
- Infrastructure costs
- Acceptance tests can create and destroy real infrastructure, which may incur expenses and consume quotas. source
- License
- The project is licensed under Mozilla Public License v2.0. source
- Plan checks
- The plancheck package includes checks for empty or non-empty plans and for resource or data source values and actions. source
- Purpose
- terraform-plugin-testing is a Go helper module for testing Terraform providers. source
- Security reporting
- The repository asks vulnerability reporters to email [email protected] and include reproduction steps, relevant tools and versions, and tool output. source
- State checks
- The statecheck package includes checks for known values, sensitive values, and comparisons between resource or data source attributes. source
- Terraform integration
- The framework uses a local Terraform binary and standard Go testing features including go test and the testing package. source
- Test modes
- Acceptance tests support Lifecycle, Import, Refresh, and Query modes. source
- Unit tests
- Unit tests can test plugin code in isolated units without network connections. source
Checked against the maker's pages on 3 Oct 2026.