with one click
run-acceptance-tests
// Run and diagnose acceptance tests for Terraform providers. Use when asked to run a TestAcc test, investigate a test failure, or set up a VCR replay.
// Run and diagnose acceptance tests for Terraform providers. Use when asked to run a TestAcc test, investigate a test failure, or set up a VCR replay.
[HINT] Download the complete skill directory including SKILL.md and all related files
| name | run-acceptance-tests |
| description | Run and diagnose acceptance tests for Terraform providers. Use when asked to run a TestAcc test, investigate a test failure, or set up a VCR replay. |
| triggers | ["run acceptance test","run TestAcc","diagnose test failure","VCR replay"] |
Acceptance tests are Go tests with the TestAcc prefix. They make real API calls and incur cost. Unit tests do not require credentials and can be run freely.
Acceptance tests typically require credentials via provider-specific environment variables (e.g., ARM_* for AzureRM). If these are not explicitly available to the agent, do not attempt to run acceptance tests directly. Instead, ask the user to run the test and return the output.
This applies to:
TestAcc* testsUnit tests (no TestAcc prefix) do not require credentials and can be run without asking.
TF_ACC=1 go test \
-run=TestAccExampleResource_basic \
-timeout 120m \
./internal/services/<service>/...
-timeout — provider acceptance tests can take 60–120 minutes depending on the API.If a valid cassette exists for the test, run in replay mode to avoid real API calls:
TC_TEST_VIA_VCR=replay \
VCR_PATH=<path-to-cassettes> \
go test \
-run=TestAccExampleResource_basic \
-timeout 10m \
./internal/services/<service>/...
Always check whether a cassette exists before running in live mode. If unsure, ask the user.
Apply these steps in order. Each step includes all previous options:
Avoid cached results — add -count=1:
TF_ACC=1 go test -run=TestAccX -count=1 -timeout 120m ./internal/services/<service>/...
Verbose output — add -v:
TF_ACC=1 go test -run=TestAccX -count=1 -v -timeout 120m ./internal/services/<service>/...
Debug logging — set TF_LOG=debug:
TF_ACC=1 TF_LOG=debug go test -run=TestAccX -count=1 -v -timeout 120m ./internal/services/<service>/...
Persist workspace — set TF_ACC_WORKING_DIR_PERSIST=1 to inspect the Terraform state and plan files after the run:
TF_ACC=1 TF_LOG=debug TF_ACC_WORKING_DIR_PERSIST=1 go test -run=TestAccX -count=1 -v -timeout 120m ./internal/services/<service>/...
To confirm a passing test actually exercises the assertion:
check.That(...).Key(...).HasValue(...) calls to an incorrect value.