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/experiment"
|
||||||
"github.com/hashicorp/terraform/helper/variables"
|
"github.com/hashicorp/terraform/helper/variables"
|
||||||
"github.com/hashicorp/terraform/helper/wrappedstreams"
|
"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/terraform"
|
||||||
"github.com/hashicorp/terraform/tfdiags"
|
"github.com/hashicorp/terraform/tfdiags"
|
||||||
"github.com/mitchellh/cli"
|
"github.com/mitchellh/cli"
|
||||||
|
@ -44,6 +46,14 @@ type Meta struct {
|
||||||
// ExtraHooks are extra hooks to add to the context.
|
// ExtraHooks are extra hooks to add to the context.
|
||||||
ExtraHooks []terraform.Hook
|
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
|
// RunningInAutomation indicates that commands are being run by an
|
||||||
// automated system rather than directly at a command prompt.
|
// automated system rather than directly at a command prompt.
|
||||||
//
|
//
|
||||||
|
|
10
commands.go
10
commands.go
|
@ -4,6 +4,9 @@ import (
|
||||||
"os"
|
"os"
|
||||||
"os/signal"
|
"os/signal"
|
||||||
|
|
||||||
|
"github.com/hashicorp/terraform/svchost/auth"
|
||||||
|
"github.com/hashicorp/terraform/svchost/disco"
|
||||||
|
|
||||||
"github.com/hashicorp/terraform/command"
|
"github.com/hashicorp/terraform/command"
|
||||||
"github.com/mitchellh/cli"
|
"github.com/mitchellh/cli"
|
||||||
)
|
)
|
||||||
|
@ -31,12 +34,19 @@ func initCommands(config *Config) {
|
||||||
inAutomation = true
|
inAutomation = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
credsSrc := auth.NoCredentials // TODO: Actually expose credentials here
|
||||||
|
services := disco.NewDisco()
|
||||||
|
services.SetCredentialsSource(credsSrc)
|
||||||
|
|
||||||
meta := command.Meta{
|
meta := command.Meta{
|
||||||
Color: true,
|
Color: true,
|
||||||
GlobalPluginDirs: globalPluginDirs(),
|
GlobalPluginDirs: globalPluginDirs(),
|
||||||
PluginOverrides: &PluginOverrides,
|
PluginOverrides: &PluginOverrides,
|
||||||
Ui: Ui,
|
Ui: Ui,
|
||||||
|
|
||||||
|
Services: services,
|
||||||
|
Credentials: credsSrc,
|
||||||
|
|
||||||
RunningInAutomation: inAutomation,
|
RunningInAutomation: inAutomation,
|
||||||
PluginCacheDir: config.PluginCacheDir,
|
PluginCacheDir: config.PluginCacheDir,
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue