hashicorp avatar

Run Acceptance Tests

Guide for running Terraform provider acceptance tests and diagnosing failures with escalating debug options.

CCM score
75 of 100
skills.sh installs
3.9K
GitHub stars
941
last updated
Aug 21, 2026
View on GitHub

Own this skill? Claim it

What it does

  • Covers running a focused TestAcc test with TF_ACC=1, an explicit -timeout, and environment variables for the single invocation
  • Includes steps to discover required credentials via PreCheck functions, os.Getenv searches, README files, and the Configure method
  • Enforces a pre-run check that credentials target a test account, since tests create real, possibly costly infrastructure
  • Escalates diagnosis through -count=1, -v, TF_LOG=debug, and TF_ACC_WORKING_DIR_PERSIST=1, plus a method for flipping false-passing tests

Install

$ npx -y skills add hashicorp/agent-skills --skill run-acceptance-tests -y

Installs into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.

Files

An acceptance test is a Go test function with the prefix TestAcc.

Before running: acceptance tests create real infrastructure against the provider's live API, which may incur cost. Confirm the configured credentials point at a test account before proceeding.

To run a focused acceptance test named TestAccFeatureHappyPath:

  1. Run go test -run=TestAccFeatureHappyPath -timeout 60m with the following environment variables:

    • TF_ACC=1

    Default to non-verbose test output. Always pass an explicit -timeout: go test kills any test run after 10 minutes by default, and acceptance tests routinely exceed that.

  2. The acceptance tests may require additional environment variables for specific providers. To discover which ones:

    • Read the test's PreCheck / testAccPreCheck function and search the test files: grep -rn "os.Getenv" --include="*_test.go".
    • Check the repository's README, CONTRIBUTING, or .env.example for documented test setup.
    • The provider's Configure method shows how credentials are resolved; use the provider-configuration skill (if available) to understand a credential provider chain.

Details

Repository
github.com/hashicorp/agent-skills
Category
Testing & QA

More from hashicorp/agent-skills

All 16

Similar to Run Acceptance Tests

More Testing & QA