terraform/internal/command/views/state_migrate.go
Radek Simko 69aa544660
command: Implement skeleton for state migrate (#38435)
* command: Implement skeleton for 'state migrate'

* address PR feedback
2026-04-27 16:39:02 +01:00

37 lines
835 B
Go

// Copyright IBM Corp. 2014, 2026
// SPDX-License-Identifier: BUSL-1.1
package views
import (
"fmt"
"github.com/hashicorp/terraform/internal/command/arguments"
"github.com/hashicorp/terraform/internal/tfdiags"
)
type StateMigrate interface {
Log(message string, params ...any)
Diagnostics(diags tfdiags.Diagnostics)
}
func NewStateMigrate(viewType arguments.ViewType, view *View) StateMigrate {
switch viewType {
case arguments.ViewHuman:
return &StateMigrateHuman{view: view}
default:
panic(fmt.Sprintf("unsupported view type: %s", viewType))
}
}
type StateMigrateHuman struct {
view *View
}
func (s *StateMigrateHuman) Diagnostics(diags tfdiags.Diagnostics) {
s.view.Diagnostics(diags)
}
func (s *StateMigrateHuman) Log(message string, params ...any) {
s.view.streams.Print(fmt.Sprintf(message, params...))
}