diff --git a/internal/backend/backendrun/cli.go b/internal/backend/backendrun/cli.go index c731ef4f5e..659ed3be80 100644 --- a/internal/backend/backendrun/cli.go +++ b/internal/backend/backendrun/cli.go @@ -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. // diff --git a/internal/cloud/backend_cli.go b/internal/cloud/backend_cli.go index 60edc2711b..b1c63962b5 100644 --- a/internal/cloud/backend_cli.go +++ b/internal/cloud/backend_cli.go @@ -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 } diff --git a/internal/command/meta_backend.go b/internal/command/meta_backend.go index 65155be5ae..0113eed31b 100644 --- a/internal/command/meta_backend.go +++ b/internal/command/meta_backend.go @@ -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 {