2020-10-16 07:25:38 -07:00
|
|
|
package main
|
|
|
|
|
|
|
|
type terraform struct {
|
|
|
|
props *properties
|
|
|
|
env environmentInfo
|
|
|
|
workspaceName string
|
|
|
|
}
|
|
|
|
|
|
|
|
func (tf *terraform) string() string {
|
|
|
|
return tf.workspaceName
|
|
|
|
}
|
|
|
|
|
|
|
|
func (tf *terraform) init(props *properties, env environmentInfo) {
|
|
|
|
tf.props = props
|
|
|
|
tf.env = env
|
|
|
|
}
|
|
|
|
|
|
|
|
func (tf *terraform) enabled() bool {
|
2021-01-05 04:05:37 -08:00
|
|
|
cmd := "terraform"
|
|
|
|
if !tf.env.hasCommand(cmd) || !tf.env.hasFolder(".terraform") {
|
2020-10-16 07:25:38 -07:00
|
|
|
return false
|
|
|
|
}
|
2021-01-05 04:05:37 -08:00
|
|
|
tf.workspaceName, _ = tf.env.runCommand(cmd, "workspace", "show")
|
2020-10-16 07:25:38 -07:00
|
|
|
return true
|
|
|
|
}
|