Fix env variable for AzureCli local config (#2248)

## Changes

Solves #1722 (current solution passes wrong variable)

## Tests

None, this is a simple find-and-replace on a previous PR.
Proof that this is the correct
[variable](https://learn.microsoft.com/en-us/cli/azure/azure-cli-configuration#cli-configuration-file).
This just passes the variable along to the Terraform environment, which
[should](https://github.com/hashicorp/terraform/issues/25416) be picked
up by Terraform.

Co-authored-by: Rik Jansen <rik.jansen2@nl.abnamro.com>
This commit is contained in:
rikjansen-hu 2025-02-04 19:30:02 +01:00 committed by GitHub
parent 84b694f2a1
commit dcc61cd763
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 4 deletions

View File

@ -101,9 +101,9 @@ var envCopy = []string{
// same auxiliary programs (e.g. `az`, or `gcloud`) as the CLI.
"PATH",
// Include $AZURE_CONFIG_FILE in set of environment variables to pass along.
// Include $AZURE_CONFIG_DIR in set of environment variables to pass along.
// This is set in Azure DevOps by the AzureCLI@2 task.
"AZURE_CONFIG_FILE",
"AZURE_CONFIG_DIR",
// Include $TF_CLI_CONFIG_FILE to override terraform provider in development.
// See: https://developer.hashicorp.com/terraform/cli/config/config-file#explicit-installation-method-configuration

View File

@ -292,7 +292,7 @@ func TestInheritEnvVars(t *testing.T) {
t.Setenv("HOME", "/home/testuser")
t.Setenv("PATH", "/foo:/bar")
t.Setenv("TF_CLI_CONFIG_FILE", "/tmp/config.tfrc")
t.Setenv("AZURE_CONFIG_FILE", "/tmp/foo/bar")
t.Setenv("AZURE_CONFIG_DIR", "/tmp/foo/bar")
ctx := context.Background()
env := map[string]string{}
@ -301,7 +301,7 @@ func TestInheritEnvVars(t *testing.T) {
assert.Equal(t, "/home/testuser", env["HOME"])
assert.Equal(t, "/foo:/bar", env["PATH"])
assert.Equal(t, "/tmp/config.tfrc", env["TF_CLI_CONFIG_FILE"])
assert.Equal(t, "/tmp/foo/bar", env["AZURE_CONFIG_FILE"])
assert.Equal(t, "/tmp/foo/bar", env["AZURE_CONFIG_DIR"])
}
}