|
|
|
|
@ -14,7 +14,6 @@ import (
|
|
|
|
|
"github.com/hashicorp/terraform/backend"
|
|
|
|
|
"github.com/hashicorp/terraform/command/clistate"
|
|
|
|
|
"github.com/hashicorp/terraform/configs/configschema"
|
|
|
|
|
"github.com/hashicorp/terraform/helper/schema"
|
|
|
|
|
"github.com/hashicorp/terraform/states/statemgr"
|
|
|
|
|
"github.com/hashicorp/terraform/terraform"
|
|
|
|
|
"github.com/hashicorp/terraform/tfdiags"
|
|
|
|
|
@ -180,11 +179,6 @@ func (b *Local) Configure(obj cty.Value) tfdiags.Diagnostics {
|
|
|
|
|
|
|
|
|
|
var diags tfdiags.Diagnostics
|
|
|
|
|
|
|
|
|
|
type Config struct {
|
|
|
|
|
Path string `hcl:"path,optional"`
|
|
|
|
|
WorkspaceDir string `hcl:"workspace_dir,optional"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if val := obj.GetAttr("path"); !val.IsNull() {
|
|
|
|
|
p := val.AsString()
|
|
|
|
|
b.StatePath = p
|
|
|
|
|
@ -456,39 +450,6 @@ func (b *Local) Colorize() *colorstring.Colorize {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (b *Local) schemaConfigure(ctx context.Context) error {
|
|
|
|
|
d := schema.FromContextBackendConfig(ctx)
|
|
|
|
|
|
|
|
|
|
// Set the path if it is set
|
|
|
|
|
pathRaw, ok := d.GetOk("path")
|
|
|
|
|
if ok {
|
|
|
|
|
path := pathRaw.(string)
|
|
|
|
|
if path == "" {
|
|
|
|
|
return fmt.Errorf("configured path is empty")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
b.StatePath = path
|
|
|
|
|
b.StateOutPath = path
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if raw, ok := d.GetOk("workspace_dir"); ok {
|
|
|
|
|
path := raw.(string)
|
|
|
|
|
if path != "" {
|
|
|
|
|
b.StateWorkspaceDir = path
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Legacy name, which ConflictsWith workspace_dir
|
|
|
|
|
if raw, ok := d.GetOk("environment_dir"); ok {
|
|
|
|
|
path := raw.(string)
|
|
|
|
|
if path != "" {
|
|
|
|
|
b.StateWorkspaceDir = path
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return nil
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// StatePaths returns the StatePath, StateOutPath, and StateBackupPath as
|
|
|
|
|
// configured from the CLI.
|
|
|
|
|
func (b *Local) StatePaths(name string) (stateIn, stateOut, backupOut string) {
|
|
|
|
|
|