mirror of https://github.com/databricks/cli.git
Pass along to Terraform process
This commit is contained in:
parent
65e4f79dfe
commit
6ad894188d
|
@ -105,6 +105,13 @@ var envCopy = []string{
|
||||||
// This is set in Azure DevOps by the AzureCLI@2 task.
|
// This is set in Azure DevOps by the AzureCLI@2 task.
|
||||||
"AZURE_CONFIG_FILE",
|
"AZURE_CONFIG_FILE",
|
||||||
|
|
||||||
|
// Include $AZURE_CONFIG_DIR in set of environment variables to pass along.
|
||||||
|
// This is set by Azure CLI as per https://learn.microsoft.com/en-us/cli/azure/azure-cli-configuration#cli-configuration-file
|
||||||
|
azureConfigDir, ok := env.Lookup(ctx, "AZURE_CONFIG_DIR")
|
||||||
|
if ok {
|
||||||
|
environ["AZURE_CONFIG_DIR"] = azureConfigDir
|
||||||
|
}
|
||||||
|
|
||||||
// Include $TF_CLI_CONFIG_FILE to override terraform provider in development.
|
// 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
|
// See: https://developer.hashicorp.com/terraform/cli/config/config-file#explicit-installation-method-configuration
|
||||||
"TF_CLI_CONFIG_FILE",
|
"TF_CLI_CONFIG_FILE",
|
||||||
|
|
|
@ -293,6 +293,7 @@ func TestInheritEnvVars(t *testing.T) {
|
||||||
t.Setenv("PATH", "/foo:/bar")
|
t.Setenv("PATH", "/foo:/bar")
|
||||||
t.Setenv("TF_CLI_CONFIG_FILE", "/tmp/config.tfrc")
|
t.Setenv("TF_CLI_CONFIG_FILE", "/tmp/config.tfrc")
|
||||||
t.Setenv("AZURE_CONFIG_FILE", "/tmp/foo/bar")
|
t.Setenv("AZURE_CONFIG_FILE", "/tmp/foo/bar")
|
||||||
|
t.Setenv("AZURE_CONFIG_DIR", "/tmp/foo")
|
||||||
|
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
env := map[string]string{}
|
env := map[string]string{}
|
||||||
|
@ -302,6 +303,7 @@ func TestInheritEnvVars(t *testing.T) {
|
||||||
assert.Equal(t, "/foo:/bar", env["PATH"])
|
assert.Equal(t, "/foo:/bar", env["PATH"])
|
||||||
assert.Equal(t, "/tmp/config.tfrc", env["TF_CLI_CONFIG_FILE"])
|
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_FILE"])
|
||||||
|
assert.Equal(t, "/tmp/foo", env["AZURE_CONFIG_DIR"])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue