| 45 | } |
| 46 | |
| 47 | func (e *executor) basicEnv() []string { |
| 48 | // Required for "terraform init" to find "git" to |
| 49 | // clone Terraform modules. |
| 50 | env := safeEnviron() |
| 51 | // Only Linux reliably works with the Terraform plugin |
| 52 | // cache directory. It's unknown why this is. |
| 53 | if e.cachePath != "" && runtime.GOOS == "linux" { |
| 54 | env = append(env, "TF_PLUGIN_CACHE_DIR="+e.cachePath) |
| 55 | } |
| 56 | if e.cliConfigPath != "" { |
| 57 | env = append(env, "TF_CLI_CONFIG_FILE="+e.cliConfigPath) |
| 58 | } |
| 59 | return env |
| 60 | } |
| 61 | |
| 62 | // execWriteOutput must only be called while the lock is held. |
| 63 | func (e *executor) execWriteOutput(ctx, killCtx context.Context, args, env []string, stdOutWriter, stdErrWriter io.WriteCloser) (err error) { |