Skip to content

Commit 682be09

Browse files
authored
Merge pull request #33 from upbound/backport-19-to-release-0.2
[Backport release-0.2] Fix: provide environment variables when running `tofu workspace new`
2 parents 7fe79a8 + bff3572 commit 682be09

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

internal/opentofu/opentofu.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,9 @@ func (h Harness) Workspace(ctx context.Context, name string) error {
254254
// is somewhat optimistic, but it shouldn't hurt to try.
255255
cmd = exec.Command(h.Path, "workspace", "new", "-no-color", name) //nolint:gosec
256256
cmd.Dir = h.Dir
257+
if len(h.Envs) > 0 {
258+
cmd.Env = append(os.Environ(), h.Envs...)
259+
}
257260

258261
if h.UsePluginCache {
259262
rwmutex.RLock()

0 commit comments

Comments
 (0)