diff --git a/command/meta.go b/command/meta.go index 806bd3961..bb58ab654 100644 --- a/command/meta.go +++ b/command/meta.go @@ -24,6 +24,8 @@ import ( "github.com/hashicorp/terraform/helper/experiment" "github.com/hashicorp/terraform/helper/variables" "github.com/hashicorp/terraform/helper/wrappedstreams" + "github.com/hashicorp/terraform/svchost/auth" + "github.com/hashicorp/terraform/svchost/disco" "github.com/hashicorp/terraform/terraform" "github.com/hashicorp/terraform/tfdiags" "github.com/mitchellh/cli" @@ -44,6 +46,14 @@ type Meta struct { // ExtraHooks are extra hooks to add to the context. ExtraHooks []terraform.Hook + // Services provides access to remote endpoint information for + // "terraform-native' services running at a specific user-facing hostname. + Services *disco.Disco + + // Credentials provides access to credentials for "terraform-native" + // services, which are accessed by a service hostname. + Credentials auth.CredentialsSource + // RunningInAutomation indicates that commands are being run by an // automated system rather than directly at a command prompt. // diff --git a/commands.go b/commands.go index 045b783d2..b3380884d 100644 --- a/commands.go +++ b/commands.go @@ -4,6 +4,9 @@ import ( "os" "os/signal" + "github.com/hashicorp/terraform/svchost/auth" + "github.com/hashicorp/terraform/svchost/disco" + "github.com/hashicorp/terraform/command" "github.com/mitchellh/cli" ) @@ -31,12 +34,19 @@ func initCommands(config *Config) { inAutomation = true } + credsSrc := auth.NoCredentials // TODO: Actually expose credentials here + services := disco.NewDisco() + services.SetCredentialsSource(credsSrc) + meta := command.Meta{ Color: true, GlobalPluginDirs: globalPluginDirs(), PluginOverrides: &PluginOverrides, Ui: Ui, + Services: services, + Credentials: credsSrc, + RunningInAutomation: inAutomation, PluginCacheDir: config.PluginCacheDir, }