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

Feature Request: workspace support #4

Closed
saitotqr opened this issue Jun 9, 2020 · 1 comment · Fixed by #56
Closed

Feature Request: workspace support #4

saitotqr opened this issue Jun 9, 2020 · 1 comment · Fixed by #56
Labels
enhancement New feature or request

Comments

@saitotqr
Copy link

saitotqr commented Jun 9, 2020

Feature Description

tfexec doesn't support a workspace-based environment, and I want support it.

Use Case(s)

I want to run Plan and Apply in a workspace environment. I have confirmed that the following code does not currently work.

package main

import (
	"context"
	"fmt"
	"github.com/hashicorp/terraform-exec/tfexec"
)

func main() {
	var dst = "/Users/takuro.saito/work/core-infra/terraform/aws/tools/slack-command/"
	var ctx context.Context
	ctx = context.Background()

	tf, err := tfexec.NewTerraform(dst, "")
	if err != nil {
		panic(err)
	}

	fmt.Println("init")
	err = tf.Init(ctx)
	if err != nil {
		panic(err)
	}
}
❯ go run main.go
init
panic: 
Error: Failed to select workspace: input not a valid number




goroutine 1 [running]:
main.main()
        /var/tmp/path/to/main.go:23 +0x133
exit status 2
@paultyng
Copy link
Contributor

Looks like we'll need to wrap list, show, select at the very least, if not the new/delete yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants