Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pass along $AZURE_CONFIG_DIR to Terraform process #2246

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions bundle/deploy/terraform/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,13 @@
// This is set in Azure DevOps by the AzureCLI@2 task.
"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")

Check failure on line 110 in bundle/deploy/terraform/init.go

View workflow job for this annotation

GitHub Actions / lint

syntax error: unexpected := in composite literal; possibly missing comma or }) (typecheck)

Check failure on line 110 in bundle/deploy/terraform/init.go

View workflow job for this annotation

GitHub Actions / lint

syntax error: unexpected := in composite literal; possibly missing comma or }) (typecheck)

Check failure on line 110 in bundle/deploy/terraform/init.go

View workflow job for this annotation

GitHub Actions / lint

syntax error: unexpected := in composite literal; possibly missing comma or }) (typecheck)

Check failure on line 110 in bundle/deploy/terraform/init.go

View workflow job for this annotation

GitHub Actions / lint

syntax error: unexpected := in composite literal; possibly missing comma or } (typecheck)

Check failure on line 110 in bundle/deploy/terraform/init.go

View workflow job for this annotation

GitHub Actions / lint

missing ',' in composite literal (typecheck)

Check failure on line 110 in bundle/deploy/terraform/init.go

View workflow job for this annotation

GitHub Actions / validate-bundle-schema

syntax error: unexpected := in composite literal; possibly missing comma or }

Check failure on line 110 in bundle/deploy/terraform/init.go

View workflow job for this annotation

GitHub Actions / tests (macos-latest)

syntax error: unexpected := in composite literal; possibly missing comma or }

Check failure on line 110 in bundle/deploy/terraform/init.go

View workflow job for this annotation

GitHub Actions / tests (macos-latest)

syntax error: unexpected := in composite literal; possibly missing comma or }

Check failure on line 110 in bundle/deploy/terraform/init.go

View workflow job for this annotation

GitHub Actions / tests (ubuntu-latest)

syntax error: unexpected := in composite literal; possibly missing comma or }

Check failure on line 110 in bundle/deploy/terraform/init.go

View workflow job for this annotation

GitHub Actions / tests (ubuntu-latest)

syntax error: unexpected := in composite literal; possibly missing comma or }

Check failure on line 110 in bundle/deploy/terraform/init.go

View workflow job for this annotation

GitHub Actions / tests (windows-latest)

syntax error: unexpected := in composite literal; possibly missing comma or }

Check failure on line 110 in bundle/deploy/terraform/init.go

View workflow job for this annotation

GitHub Actions / tests (windows-latest)

syntax error: unexpected := in composite literal; possibly missing comma or }
if ok {

Check failure on line 111 in bundle/deploy/terraform/init.go

View workflow job for this annotation

GitHub Actions / lint

expected operand, found 'if' (typecheck)
environ["AZURE_CONFIG_DIR"] = azureConfigDir

Check failure on line 112 in bundle/deploy/terraform/init.go

View workflow job for this annotation

GitHub Actions / lint

expected '==', found '=' (typecheck)
}

// 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
"TF_CLI_CONFIG_FILE",
Expand Down
2 changes: 2 additions & 0 deletions bundle/deploy/terraform/init_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,7 @@ func TestInheritEnvVars(t *testing.T) {
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")

ctx := context.Background()
env := map[string]string{}
Expand All @@ -302,6 +303,7 @@ func TestInheritEnvVars(t *testing.T) {
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", env["AZURE_CONFIG_DIR"])
}
}

Expand Down
Loading