mirror of
https://github.com/hashicorp/terraform.git
synced 2026-06-08 16:35:25 -04:00
backend/cloud: expose View to enable reuse in a (cloud) backend
Signed-off-by: Bruno Schaatsbergen <git@bschaatsbergen.com>
This commit is contained in:
parent
94c732b7a5
commit
f1428b3388
3 changed files with 6 additions and 4 deletions
|
|
@ -9,6 +9,7 @@ import (
|
|||
|
||||
"github.com/hashicorp/terraform/internal/backend"
|
||||
"github.com/hashicorp/terraform/internal/command/arguments"
|
||||
"github.com/hashicorp/terraform/internal/command/views"
|
||||
"github.com/hashicorp/terraform/internal/terminal"
|
||||
"github.com/hashicorp/terraform/internal/terraform"
|
||||
)
|
||||
|
|
@ -61,10 +62,11 @@ type CLIOpts struct {
|
|||
// for tailoring the output to fit the attached terminal, for example.
|
||||
Streams *terminal.Streams
|
||||
|
||||
// FIXME: Temporarily exposing ViewType to the backend.
|
||||
// FIXME: Temporarily exposing ViewType and View to the backend.
|
||||
// This is a workaround until the backend is refactored to support
|
||||
// native View handling.
|
||||
ViewType arguments.ViewType
|
||||
View *views.View
|
||||
|
||||
// StatePath is the local path where state is read from.
|
||||
//
|
||||
|
|
|
|||
|
|
@ -26,8 +26,7 @@ func (b *Cloud) CLIInit(opts *backendrun.CLIOpts) error {
|
|||
Streams: opts.Streams,
|
||||
Colorize: opts.CLIColor,
|
||||
}
|
||||
view := views.NewView(opts.Streams)
|
||||
b.View = views.NewCloud(opts.ViewType, view)
|
||||
b.View = views.NewCloud(opts.ViewType, opts.View)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
|
|||
|
|
@ -151,10 +151,11 @@ func (m *Meta) Backend(opts *BackendOpts) (backendrun.OperationsBackend, tfdiags
|
|||
}
|
||||
cliOpts.Validation = true
|
||||
|
||||
// FIXME: Temporarily exposing ViewType to the backend.
|
||||
// FIXME: Temporarily exposing ViewType and View to the backend.
|
||||
// This is a workaround until the backend is refactored to support
|
||||
// native View handling.
|
||||
cliOpts.ViewType = opts.ViewType
|
||||
cliOpts.View = m.View
|
||||
|
||||
// If the backend supports CLI initialization, do it.
|
||||
if cli, ok := b.(backendrun.CLI); ok {
|
||||
|
|
|
|||
Loading…
Reference in a new issue