From bb3d513c4f267dcb320d872333f4e73f7923b4fb Mon Sep 17 00:00:00 2001 From: Pam Selle <204372+pselle@users.noreply.github.com> Date: Mon, 13 Jan 2020 15:22:34 -0500 Subject: [PATCH] Some deletions from static analysis --- backend/local/backend.go | 39 --------------------------------------- config.go | 25 ------------------------- 2 files changed, 64 deletions(-) diff --git a/backend/local/backend.go b/backend/local/backend.go index 62c016c49..e73959499 100644 --- a/backend/local/backend.go +++ b/backend/local/backend.go @@ -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) { diff --git a/config.go b/config.go index fcb48ffb9..a3ff1e88e 100644 --- a/config.go +++ b/config.go @@ -24,23 +24,6 @@ type Config = cliconfig.Config // discovery behavior for a particular hostname. 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. func ConfigDir() (string, error) { return cliconfig.ConfigDir() @@ -52,11 +35,3 @@ func ConfigDir() (string, error) { func LoadConfig() (*Config, tfdiags.Diagnostics) { 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() -}