feat(acc): Add provider_acceptance_tests input for automated acceptance test setup (#97)

Signed-off-by: hoivikaj <github@hoivik.co>
Signed-off-by: Anthony Hoivik <38190936+hoivikaj@users.noreply.github.com>
This commit is contained in:
Anthony Hoivik authored and GitHub committed 2026-04-15 23:08:57 -03:00
1 parent 4bcfe8cded
commit 34bf4e3161
6 files changed
+140 -14

No files matched your search

+17
View File
@@ -76,6 +76,19 @@ steps:
cache: true
```
Provider acceptance test environment variables can be configured automatically by setting `provider_acceptance_tests` to `true`. This exports `TF_ACC`, `TF_ACC_PROVIDER_NAMESPACE`, `TF_ACC_PROVIDER_HOST`, and `TF_ACC_TERRAFORM_PATH` so you don't need to set them manually:
```yaml
steps:
- uses: opentofu/setup-opentofu@v2
with:
tofu_wrapper: false
provider_acceptance_tests: true
- run: go mod download
- run: go test -v -cover ./...
timeout-minutes: 10
```
Validation can be enabled to check the downloaded OpenTofu CLI SHA256 hash against a newline-delimited list of checksums:
```yaml
@@ -285,6 +298,10 @@ The action supports the following inputs:
the `tofu` binary and expose its STDOUT, STDERR, and exit code as outputs
named `stdout`, `stderr`, and `exitcode` respectively. Defaults to `true`.
- `cache` - (optional) Whether to use GitHub Actions tool-cache to store and reuse downloaded OpenTofu binaries. Defaults to `false`.
- `provider_acceptance_tests` - (optional) Whether to automatically set environment variables for running
OpenTofu provider acceptance tests. When set to `true`, the following environment variables are exported:
`TF_ACC=1`, `TF_ACC_PROVIDER_NAMESPACE=hashicorp`, `TF_ACC_PROVIDER_HOST=registry.opentofu.org`, and
`TF_ACC_TERRAFORM_PATH=<path to tofu binary>`. Defaults to `false`.
- `github_token` - (optional) Override the GitHub token read from the environment variable. Defaults to the value of the `GITHUB_TOKEN` environment variable unless running on Forgejo or Gitea.
- `checksums` - (optional) A newline-delimited list of valid checksums (SHA256) for the downloaded OpenTofu CLI ZIP. When set, the action will verify the ZIP matches one of the checksums before proceeding. Defaults to `[]`