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

+12 -1
View File
@@ -7,7 +7,7 @@
// Node.js core
import { promises as fs } from 'fs';
import { platform, arch } from 'os';
import { sep, resolve, dirname } from 'path';
import { sep, join, resolve, dirname } from 'path';
import { fileURLToPath } from 'url';
// External
@@ -177,6 +177,7 @@ async function run () {
const credentialsHostname = getInput('cli_config_credentials_hostname');
const credentialsToken = getInput('cli_config_credentials_token');
const wrapper = getInput('tofu_wrapper') === 'true';
const providerAcceptanceTest = getInput('provider_acceptance_tests') === 'true';
const useCache = getInput('cache') === 'true';
const checksums = getMultilineInput('checksums');
let githubToken = getInput('github_token');
@@ -250,6 +251,16 @@ async function run () {
// Add to path
addPath(pathToCLI);
// Set up provider acceptance test environment variables
if (providerAcceptanceTest) {
const exeSuffix = platform().startsWith('win') ? '.exe' : '';
const binaryName = wrapper ? `tofu-bin${exeSuffix}` : `tofu${exeSuffix}`;
exportVariable('TF_ACC', '1');
exportVariable('TF_ACC_PROVIDER_NAMESPACE', 'hashicorp');
exportVariable('TF_ACC_PROVIDER_HOST', 'registry.opentofu.org');
exportVariable('TF_ACC_TERRAFORM_PATH', join(pathToCLI, binaryName));
}
// Add credentials to file if they are provided
if (credentialsHostname && credentialsToken) {
await addCredentials(credentialsHostname, credentialsToken, osPlatform);