github.com/nicgrayson/terraform@v0.4.3-0.20150415203910-c4de50829380/command/config.go (about) 1 package command 2 3 import ( 4 "github.com/hashicorp/terraform/terraform" 5 "github.com/mitchellh/cli" 6 ) 7 8 // Config is a structure used to configure many commands with Terraform 9 // configurations. 10 type Config struct { 11 Hooks []terraform.Hook 12 Providers map[string]terraform.ResourceProviderFactory 13 Ui cli.Ui 14 } 15 16 func (c *Config) ContextOpts() *terraform.ContextOpts { 17 hooks := make([]terraform.Hook, len(c.Hooks)+1) 18 copy(hooks, c.Hooks) 19 hooks[len(c.Hooks)] = &UiHook{Ui: c.Ui} 20 21 return &terraform.ContextOpts{ 22 Hooks: hooks, 23 Providers: c.Providers, 24 } 25 }