main+command: provide service disco and creds to commands
The command package is the main place we need access to these, so that we can use them during init (to install packages, for example) and so that we can use them to configure remote backends. For the moment we're just providing an empty credentials object, which will start to include both statically-configured and helper-program-provided credentials sources in subsequent commits.
This commit is contained in:
parent
0db521a281
commit
865e61b4ea
|
@ -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.
|
||||
//
|
||||
|
|
10
commands.go
10
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,
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue