mirror of
https://github.com/opentofu/opentofu.git
synced 2024-12-29 10:21:01 -06:00
26 lines
570 B
Go
26 lines
570 B
Go
package command
|
|
|
|
import (
|
|
"github.com/hashicorp/terraform/terraform"
|
|
"github.com/mitchellh/cli"
|
|
)
|
|
|
|
// Config is a structure used to configure many commands with Terraform
|
|
// configurations.
|
|
type Config struct {
|
|
Hooks []terraform.Hook
|
|
Providers map[string]terraform.ResourceProviderFactory
|
|
Ui cli.Ui
|
|
}
|
|
|
|
func (c *Config) ContextOpts() *terraform.ContextOpts {
|
|
hooks := make([]terraform.Hook, len(c.Hooks)+1)
|
|
copy(hooks, c.Hooks)
|
|
hooks[len(c.Hooks)] = &UiHook{Ui: c.Ui}
|
|
|
|
return &terraform.ContextOpts{
|
|
Hooks: hooks,
|
|
Providers: c.Providers,
|
|
}
|
|
}
|