skills.vishalvoidskills/vishalvoid
Technical & DevelopmentIntermediate

provider-test-patterns

Acceptance test patterns for Terraform providers using terraform-plugin-testing

Developer Setup

Setup & Installation

bash
npx skills add https://github.com/hashicorp/agent-skills --skill provider-test-patterns

Overview

What This Skill Does

Patterns for writing Terraform provider acceptance tests using terraform-plugin-testing with the Plugin Framework. Covers TestCase and TestStep structure, ConfigStateChecks with custom StateCheck implementations, plan checks, import testing, sweepers, and ephemeral resource testing. Includes concrete scenarios for basic, update, disappears, validation, and regression tests.

Application

When to use this Skill

Documentation

Show Skills.md file

Provider Acceptance Test Patterns

Patterns for writing acceptance tests using terraform-plugin-testing with the Plugin Framework.

Source: HashiCorp Testing Patterns

References (load when needed):

  • references/checks.md — statecheck, plancheck, knownvalue types, tfjsonpath, comparers
  • references/sweepers.md — sweeper setup, TestMain, dependencies
  • references/ephemeral.md — ephemeral resource testing, echoprovider, multi-step patterns

Test Lifecycle

The framework runs each TestStep through: plan → apply → refresh → final plan. If the final plan shows a diff, the test fails (unless ExpectNonEmptyPlan is set). After all steps, destroy runs followed by CheckDestroy. This means every test automatically verifies that configurations apply cleanly and produce no drift — no assertions needed for that.


Lines 1 - 25 of 396

Recommendations

Explore other random skills

All skillsMy patterns