This commit is contained in:
Brandon Croft 2025-12-16 15:57:36 +00:00 committed by GitHub
commit fefd48d0f9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 44 additions and 70 deletions

View file

@ -103,15 +103,15 @@ credentials "${credentialsHostname}" {
}`.trim();
// eslint-enable
// default to OS-specific path
let credsFile = osPlat === 'win32'
? `${process.env.APPDATA}/terraform.rc`
: `${process.env.HOME}/.terraformrc`;
// set or use the TF_CLI_CONFIG_FILE environment variable
let credsFile = process.env.TF_CLI_CONFIG_FILE;
if (!credsFile) {
credsFile = path.join(process.env.RUNNER_TEMP, 'setup-terraform.tfrc');
core.debug(`Default CLI config created as ${credsFile}`);
core.exportVariable('TF_CLI_CONFIG_FILE', credsFile);
}
// override with TF_CLI_CONFIG_FILE environment variable
credsFile = process.env.TF_CLI_CONFIG_FILE ? process.env.TF_CLI_CONFIG_FILE : credsFile;
// get containing folder
// create containing folder in case it doesn't exist
const credsFolder = path.dirname(credsFile);
core.debug(`Creating ${credsFolder}`);