provider-test-patterns

Generate structured Terraform provider acceptance test patterns with state and plan checks.

790|117|Updated Nov 8, 2025
One-click install
npx skills add https://github.com/hashicorp/agent-skills --skill provider-test-patterns-hashicorp
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: provider-test-patterns
Source: https://github.com/hashicorp/agent-skills/tree/main/terraform/provider-development/skills/provider-test-patterns
Command: npx skills add https://github.com/hashicorp/agent-skills --skill provider-test-patterns-hashicorp

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires terraform-plugin-testing, statecheck, and includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill addresses the challenge of writing comprehensive and maintainable Terraform provider acceptance tests by providing structured patterns and best practices.

Core Features & Use Cases

  • Structured Test Patterns: Offers a set of patterns for writing tests, including basic, update, disappears, validation, and regression scenarios.
  • Ephemeral Resource Testing: Includes guidance on testing ephemeral resources that reference external data without persisting it to plan or state artifacts.
  • Config Helpers: Provides functions for configuring tests, including setup and teardown, and assertion methods for state and plan checks.
  • Use Case: If you are a Terraform provider developer, this Skill will help you write tests for your provider that are both thorough and easy to maintain.

Quick Start

Use the provider-test-patterns skill to generate a basic acceptance test for your Terraform provider.

Frequently Asked Questions about provider-test-patterns

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I write acceptance tests for a Terraform provider?

To write acceptance tests for a Terraform provider, use structured patterns covering basic, update, disappears, validation, and regression scenarios. These patterns integrate terraform-plugin-testing and statecheck to validate plan and state artifacts effectively.

What are the best practices for testing ephemeral resources in Terraform providers?

Testing ephemeral resources in Terraform providers requires patterns that reference external data without persisting it to plan or state artifacts. Following these best practices ensures your automated tests remain thorough and maintainable.

How do statecheck and plancheck assertions work in provider testing?

Statecheck and plancheck assertions work in provider testing by validating state and plan outputs during acceptance tests. They provide structured assertion methods for setup and teardown to verify code quality and resource configuration.

Do I need terraform-plugin-testing to use these provider test patterns?

Yes, terraform-plugin-testing is required to use these provider test patterns. The structured testing approach relies on this framework alongside statecheck to execute automated acceptance tests and validate state artifacts.

What is a regression test pattern for Terraform provider development?

A regression test pattern for Terraform provider development is a structured acceptance test scenario designed to prevent previous bugs from reoccurring. It ensures provider code quality by validating behavior across basic and update scenarios.