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

terraform/exec: Pass through all environment variables #139

Merged
merged 1 commit into from
Jun 5, 2020
Merged
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
14 changes: 5 additions & 9 deletions internal/terraform/exec/exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,11 @@ import (

var defaultExecTimeout = 30 * time.Second

// Environment variables to pass through to Terraform
var passthroughEnvVars = []string{
// This allows Terraform to find custom-built providers
"HOME", "USER", "USERPROFILE",
// This allows Terraform to create crash log in the desired temp directory
// os.TempDir would otherwise fall back to C:\Windows on Windows
// which has no write permissions for non-admins
"TMPDIR", "TMP", "TEMP",
}
// We pass through all variables, but longer term we'll need to reflect
// that some variables might be workspace/directory specific
// and passing through these may be dangerous once the LS
// starts to execute commands which can mutate the state
var passthroughEnvVars = os.Environ()

// cmdCtxFunc allows mocking of Terraform in tests while retaining
// ability to pass context for timeout/cancellation
Expand Down