example: add isCompatible to all options
diff --git a/tfexec/workspace_new.go b/tfexec/workspace_new.go
index 4778a8c..ee082f1 100644
--- a/tfexec/workspace_new.go
+++ b/tfexec/workspace_new.go
@@ -5,6 +5,8 @@
"fmt"
"os/exec"
"strconv"
+
+ "github.com/hashicorp/go-version"
)
type workspaceNewConfig struct {
@@ -21,12 +23,17 @@
// WorkspaceNewCmdOption represents options that are applicable to the WorkspaceNew method.
type WorkspaceNewCmdOption interface {
configureWorkspaceNew(*workspaceNewConfig)
+ isCompatible(tfv *version.Version) bool
}
func (opt *LockOption) configureWorkspaceNew(conf *workspaceNewConfig) {
conf.lock = opt.lock
}
+func (opt *LockOption) isCompatible(tfv *version.Version) bool {
+ return versionInRange(tfv, tf0_12_0, nil)
+}
+
func (opt *LockTimeoutOption) configureWorkspaceNew(conf *workspaceNewConfig) {
conf.lockTimeout = opt.timeout
}