Some deletions from static analysis
This commit is contained in:
parent
58ef73814e
commit
bb3d513c4f
|
@ -14,7 +14,6 @@ import (
|
||||||
"github.com/hashicorp/terraform/backend"
|
"github.com/hashicorp/terraform/backend"
|
||||||
"github.com/hashicorp/terraform/command/clistate"
|
"github.com/hashicorp/terraform/command/clistate"
|
||||||
"github.com/hashicorp/terraform/configs/configschema"
|
"github.com/hashicorp/terraform/configs/configschema"
|
||||||
"github.com/hashicorp/terraform/helper/schema"
|
|
||||||
"github.com/hashicorp/terraform/states/statemgr"
|
"github.com/hashicorp/terraform/states/statemgr"
|
||||||
"github.com/hashicorp/terraform/terraform"
|
"github.com/hashicorp/terraform/terraform"
|
||||||
"github.com/hashicorp/terraform/tfdiags"
|
"github.com/hashicorp/terraform/tfdiags"
|
||||||
|
@ -180,11 +179,6 @@ func (b *Local) Configure(obj cty.Value) tfdiags.Diagnostics {
|
||||||
|
|
||||||
var diags 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() {
|
if val := obj.GetAttr("path"); !val.IsNull() {
|
||||||
p := val.AsString()
|
p := val.AsString()
|
||||||
b.StatePath = p
|
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
|
// StatePaths returns the StatePath, StateOutPath, and StateBackupPath as
|
||||||
// configured from the CLI.
|
// configured from the CLI.
|
||||||
func (b *Local) StatePaths(name string) (stateIn, stateOut, backupOut string) {
|
func (b *Local) StatePaths(name string) (stateIn, stateOut, backupOut string) {
|
||||||
|
|
25
config.go
25
config.go
|
@ -24,23 +24,6 @@ type Config = cliconfig.Config
|
||||||
// discovery behavior for a particular hostname.
|
// discovery behavior for a particular hostname.
|
||||||
type ConfigHost = cliconfig.ConfigHost
|
type ConfigHost = cliconfig.ConfigHost
|
||||||
|
|
||||||
// ConfigCredentialsHelper is the structure of the "credentials_helper"
|
|
||||||
// nested block within the CLI configuration.
|
|
||||||
type ConfigCredentialsHelper = cliconfig.ConfigCredentialsHelper
|
|
||||||
|
|
||||||
// BuiltinConfig is the built-in defaults for the configuration. These
|
|
||||||
// can be overridden by user configurations.
|
|
||||||
var BuiltinConfig = cliconfig.BuiltinConfig
|
|
||||||
|
|
||||||
// ConfigFile returns the default path to the configuration file.
|
|
||||||
//
|
|
||||||
// On Unix-like systems this is the ".terraformrc" file in the home directory.
|
|
||||||
// On Windows, this is the "terraform.rc" file in the application data
|
|
||||||
// directory.
|
|
||||||
func ConfigFile() (string, error) {
|
|
||||||
return cliconfig.ConfigFile()
|
|
||||||
}
|
|
||||||
|
|
||||||
// ConfigDir returns the configuration directory for Terraform.
|
// ConfigDir returns the configuration directory for Terraform.
|
||||||
func ConfigDir() (string, error) {
|
func ConfigDir() (string, error) {
|
||||||
return cliconfig.ConfigDir()
|
return cliconfig.ConfigDir()
|
||||||
|
@ -52,11 +35,3 @@ func ConfigDir() (string, error) {
|
||||||
func LoadConfig() (*Config, tfdiags.Diagnostics) {
|
func LoadConfig() (*Config, tfdiags.Diagnostics) {
|
||||||
return cliconfig.LoadConfig()
|
return cliconfig.LoadConfig()
|
||||||
}
|
}
|
||||||
|
|
||||||
// EnvConfig returns a Config populated from environment variables.
|
|
||||||
//
|
|
||||||
// Any values specified in this config should override those set in the
|
|
||||||
// configuration file.
|
|
||||||
func EnvConfig() *Config {
|
|
||||||
return cliconfig.EnvConfig()
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in New Issue