views

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 24, 2026 License: MPL-2.0 Imports: 55 Imported by: 0

Documentation

Index

Constants

View Source
const JSON_UI_VERSION = "1.2"

This version describes the schema of JSON UI messages. This version must be updated after making any changes to this view, the jsonHook, or any of the command/views/json package.

Variables

View Source
var ErrorInputDisabled = fmt.Errorf("in this view cannot ask user input")

Functions

func NewUIOptionalHook

func NewUIOptionalHook(view *View) tofu.Hook

func NewViewUI

func NewViewUI(args arguments.ViewOptions, view *View, oldUi cli.Ui) cli.Ui

func SaveErroredTestStateFile

func SaveErroredTestStateFile(state *states.State, run *moduletest.Run, file *moduletest.File, view Test)

SaveErroredTestStateFile is a helper function to invoked in DestroySummary to store the state to errored_test.tfstate and handle associated diagnostics and errors with this operation

Types

type Apply

type Apply interface {
	ResourceCount(stateOutPath string)
	Outputs(outputValues map[string]*states.OutputValue)

	Operation() Operation
	Hooks() []tofu.Hook

	Diagnostics(diags tfdiags.Diagnostics)
	HelpPrompt()

	// Backend returns the non-command view that contains methods to provide
	// progress output for the backend operations.
	Backend() Backend
}

The Apply view is used for the apply command.

func NewApply

func NewApply(args arguments.ViewOptions, destroy bool, view *View) Apply

NewApply returns an initialized Apply implementation for the given ViewType.

type ApplyHuman

type ApplyHuman struct {
	// contains filtered or unexported fields
}

The ApplyHuman implementation renders human-readable text logs, suitable for a scrolling terminal.

func (*ApplyHuman) Backend

func (v *ApplyHuman) Backend() Backend

func (*ApplyHuman) Diagnostics

func (v *ApplyHuman) Diagnostics(diags tfdiags.Diagnostics)

func (*ApplyHuman) HelpPrompt

func (v *ApplyHuman) HelpPrompt()

func (*ApplyHuman) Hooks

func (v *ApplyHuman) Hooks() []tofu.Hook

func (*ApplyHuman) Operation

func (v *ApplyHuman) Operation() Operation

func (*ApplyHuman) Outputs

func (v *ApplyHuman) Outputs(outputValues map[string]*states.OutputValue)

func (*ApplyHuman) ResourceCount

func (v *ApplyHuman) ResourceCount(stateOutPath string)

type ApplyJSON

type ApplyJSON struct {
	// contains filtered or unexported fields
}

The ApplyJSON implementation renders streaming JSON logs, suitable for integrating with other software.

func (*ApplyJSON) Backend

func (v *ApplyJSON) Backend() Backend

func (*ApplyJSON) Diagnostics

func (v *ApplyJSON) Diagnostics(diags tfdiags.Diagnostics)

func (*ApplyJSON) HelpPrompt

func (v *ApplyJSON) HelpPrompt()

func (*ApplyJSON) Hooks

func (v *ApplyJSON) Hooks() []tofu.Hook

func (*ApplyJSON) Operation

func (v *ApplyJSON) Operation() Operation

func (*ApplyJSON) Outputs

func (v *ApplyJSON) Outputs(outputValues map[string]*states.OutputValue)

func (*ApplyJSON) ResourceCount

func (v *ApplyJSON) ResourceCount(stateOutPath string)

type ApplyMulti

type ApplyMulti []Apply

func (ApplyMulti) Backend

func (m ApplyMulti) Backend() Backend

func (ApplyMulti) Diagnostics

func (m ApplyMulti) Diagnostics(diags tfdiags.Diagnostics)

func (ApplyMulti) HelpPrompt

func (m ApplyMulti) HelpPrompt()

func (ApplyMulti) Hooks

func (m ApplyMulti) Hooks() []tofu.Hook

func (ApplyMulti) Operation

func (m ApplyMulti) Operation() Operation

func (ApplyMulti) Outputs

func (m ApplyMulti) Outputs(outputValues map[string]*states.OutputValue)

func (ApplyMulti) ResourceCount

func (m ApplyMulti) ResourceCount(stateOutPath string)

type Backend

type Backend interface {
	Basic
	InitializingBackend()
	InitializingCloudBackend()
	BackendTypeAlias(backendType, canonType string)
	MigratingFromCloudToLocal()
	UnconfiguringBackendType(backendType string)
	BackendTypeUnset(backendType string)
	BackendTypeSet(backendType string)
	CloudBackendUpdated()
	MigratingLocalTypeToCloud(fromBackendType string)
	MigratingCloudToLocalType(toBackendType string)
	BackendTypeChanged(oldBackendType string, newBackendType string)
	BackendReconfigured()
	MigrationCompleted(workspaces []string, currentWs string)

	StateLocker() StateLocker
}

func NewBackendHuman

func NewBackendHuman(view *View) Backend

NewBackendHuman returns a new Backend instance that will print in human format. This particular function is meant to be used only in special cases, where the Backend view cannot be acquired from a command related view (eg: Apply.Backend). At the moment of writing this comment, this function is meant to be used only to create this view in cases where it is not initialised correctly, which are paths that are only reachable from incomplete configured tests.

type BackendHuman

type BackendHuman struct {
	// contains filtered or unexported fields
}

func (*BackendHuman) BackendReconfigured

func (v *BackendHuman) BackendReconfigured()

func (*BackendHuman) BackendTypeAlias

func (v *BackendHuman) BackendTypeAlias(backendType, canonType string)

func (*BackendHuman) BackendTypeChanged

func (v *BackendHuman) BackendTypeChanged(oldBackendType string, newBackendType string)

func (*BackendHuman) BackendTypeSet

func (v *BackendHuman) BackendTypeSet(backendType string)

func (*BackendHuman) BackendTypeUnset

func (v *BackendHuman) BackendTypeUnset(backendType string)

func (*BackendHuman) CloudBackendUpdated

func (v *BackendHuman) CloudBackendUpdated()

func (*BackendHuman) Diagnostics

func (v *BackendHuman) Diagnostics(diags tfdiags.Diagnostics)

func (*BackendHuman) InitializingBackend

func (v *BackendHuman) InitializingBackend()

func (*BackendHuman) InitializingCloudBackend

func (v *BackendHuman) InitializingCloudBackend()

func (*BackendHuman) MigratingCloudToLocalType

func (v *BackendHuman) MigratingCloudToLocalType(toBackendType string)

func (*BackendHuman) MigratingFromCloudToLocal

func (v *BackendHuman) MigratingFromCloudToLocal()

func (*BackendHuman) MigratingLocalTypeToCloud

func (v *BackendHuman) MigratingLocalTypeToCloud(fromBackendType string)

func (*BackendHuman) MigrationCompleted

func (v *BackendHuman) MigrationCompleted(workspaces []string, currentWs string)

func (*BackendHuman) StateLocker

func (v *BackendHuman) StateLocker() StateLocker

func (*BackendHuman) UnconfiguringBackendType

func (v *BackendHuman) UnconfiguringBackendType(backendType string)

type BackendJSON

type BackendJSON struct {
	// contains filtered or unexported fields
}

func (*BackendJSON) BackendReconfigured

func (v *BackendJSON) BackendReconfigured()

func (*BackendJSON) BackendTypeAlias

func (v *BackendJSON) BackendTypeAlias(backendType, canonType string)

func (*BackendJSON) BackendTypeChanged

func (v *BackendJSON) BackendTypeChanged(oldBackendType string, newBackendType string)

func (*BackendJSON) BackendTypeSet

func (v *BackendJSON) BackendTypeSet(backendType string)

func (*BackendJSON) BackendTypeUnset

func (v *BackendJSON) BackendTypeUnset(backendType string)

func (*BackendJSON) CloudBackendUpdated

func (v *BackendJSON) CloudBackendUpdated()

func (*BackendJSON) Diagnostics

func (v *BackendJSON) Diagnostics(diags tfdiags.Diagnostics)

func (*BackendJSON) InitializingBackend

func (v *BackendJSON) InitializingBackend()

func (*BackendJSON) InitializingCloudBackend

func (v *BackendJSON) InitializingCloudBackend()

func (*BackendJSON) MigratingCloudToLocalType

func (v *BackendJSON) MigratingCloudToLocalType(toBackendType string)

func (*BackendJSON) MigratingFromCloudToLocal

func (v *BackendJSON) MigratingFromCloudToLocal()

func (*BackendJSON) MigratingLocalTypeToCloud

func (v *BackendJSON) MigratingLocalTypeToCloud(fromBackendType string)

func (*BackendJSON) MigrationCompleted

func (v *BackendJSON) MigrationCompleted(workspaces []string, currentWs string)

func (*BackendJSON) StateLocker

func (v *BackendJSON) StateLocker() StateLocker

func (*BackendJSON) UnconfiguringBackendType

func (v *BackendJSON) UnconfiguringBackendType(backendType string)

type BackendMulti

type BackendMulti []Backend

func (BackendMulti) BackendReconfigured

func (m BackendMulti) BackendReconfigured()

func (BackendMulti) BackendTypeAlias

func (m BackendMulti) BackendTypeAlias(backendType, canonType string)

func (BackendMulti) BackendTypeChanged

func (m BackendMulti) BackendTypeChanged(oldBackendType string, newBackendType string)

func (BackendMulti) BackendTypeSet

func (m BackendMulti) BackendTypeSet(backendType string)

func (BackendMulti) BackendTypeUnset

func (m BackendMulti) BackendTypeUnset(backendType string)

func (BackendMulti) CloudBackendUpdated

func (m BackendMulti) CloudBackendUpdated()

func (BackendMulti) Diagnostics

func (m BackendMulti) Diagnostics(diags tfdiags.Diagnostics)

func (BackendMulti) InitializingBackend

func (m BackendMulti) InitializingBackend()

func (BackendMulti) InitializingCloudBackend

func (m BackendMulti) InitializingCloudBackend()

func (BackendMulti) MigratingCloudToLocalType

func (m BackendMulti) MigratingCloudToLocalType(toBackendType string)

func (BackendMulti) MigratingFromCloudToLocal

func (m BackendMulti) MigratingFromCloudToLocal()

func (BackendMulti) MigratingLocalTypeToCloud

func (m BackendMulti) MigratingLocalTypeToCloud(fromBackendType string)

func (BackendMulti) MigrationCompleted

func (m BackendMulti) MigrationCompleted(workspaces []string, currentWs string)

func (BackendMulti) StateLocker

func (m BackendMulti) StateLocker() StateLocker

func (BackendMulti) UnconfiguringBackendType

func (m BackendMulti) UnconfiguringBackendType(backendType string)

type BackendRemote

type BackendRemote interface {
	Basic
	Output(msg string, color bool)
	RunWarning(msg string)
	RenderLog(log *jsonformat.JSONLog) error
	RenderHumanPlan(plan jsonformat.Plan, mode plans.Mode)
	OperationCancelled()
	OperationNotCancelled()
	PreRefresh()
	InitialRetryError(isRemote bool)
	RepeatedRetryError(elapsed time.Duration)
	UnavailableVersionInBackend(localVersion, usedVersion string)
	ApplySavedHeader()
	LockTimeoutError()
	RemoteWorkspaceInRelativeDirectory(wd string, configDir string)
	WaitingForCostEstimation(elapsedHint string)
	WaitingForOperationToStart(opType string, elapsed string)
	WaitingForTheManuallyLockedWorkspace(elapsedHint string)
	WaitingForRuns(noOfRuns int, elapsedHint string)
	WaitingForQueuedRuns(noOfRuns int, elapsedHint string)
	OperationHeader(isApply bool, isRemote bool)
}

func NewBackendRemote

func NewBackendRemote(view *View) BackendRemote

NewBackendRemote returns an implementation of BackendRemote which is meant to be used for the cloud and remote implementations. Contrary to the idea of this package to have only commands related views creation exposed and non-commands views to be retrieved from the commands related one, this is exposed to be created because this has no json implementation and because the plug of this view in the places where it's needed is not yet straightforward.

type BackendRemoteHuman

type BackendRemoteHuman struct {
	// contains filtered or unexported fields
}

func (*BackendRemoteHuman) ApplySavedHeader

func (v *BackendRemoteHuman) ApplySavedHeader()

func (*BackendRemoteHuman) Diagnostics

func (v *BackendRemoteHuman) Diagnostics(diags tfdiags.Diagnostics)

func (*BackendRemoteHuman) InitialRetryError

func (v *BackendRemoteHuman) InitialRetryError(isRemote bool)

func (*BackendRemoteHuman) LockTimeoutError

func (v *BackendRemoteHuman) LockTimeoutError()

func (*BackendRemoteHuman) OperationCancelled

func (v *BackendRemoteHuman) OperationCancelled()

func (*BackendRemoteHuman) OperationHeader

func (v *BackendRemoteHuman) OperationHeader(isApply bool, isRemote bool)

func (*BackendRemoteHuman) OperationNotCancelled

func (v *BackendRemoteHuman) OperationNotCancelled()

func (*BackendRemoteHuman) Output

func (v *BackendRemoteHuman) Output(msg string, colored bool)

func (*BackendRemoteHuman) PreRefresh

func (v *BackendRemoteHuman) PreRefresh()

func (*BackendRemoteHuman) RemoteWorkspaceInRelativeDirectory

func (v *BackendRemoteHuman) RemoteWorkspaceInRelativeDirectory(wd string, configDir string)

func (*BackendRemoteHuman) RenderHumanPlan

func (v *BackendRemoteHuman) RenderHumanPlan(plan jsonformat.Plan, mode plans.Mode)

func (*BackendRemoteHuman) RenderLog

func (v *BackendRemoteHuman) RenderLog(log *jsonformat.JSONLog) error

func (*BackendRemoteHuman) RepeatedRetryError

func (v *BackendRemoteHuman) RepeatedRetryError(elapsed time.Duration)

func (*BackendRemoteHuman) RunWarning

func (v *BackendRemoteHuman) RunWarning(description string)

func (*BackendRemoteHuman) UnavailableVersionInBackend

func (v *BackendRemoteHuman) UnavailableVersionInBackend(localVersion, usedVersion string)

func (*BackendRemoteHuman) WaitingForCostEstimation

func (v *BackendRemoteHuman) WaitingForCostEstimation(elapsedHint string)

func (*BackendRemoteHuman) WaitingForOperationToStart

func (v *BackendRemoteHuman) WaitingForOperationToStart(opType string, elapsed string)

func (*BackendRemoteHuman) WaitingForQueuedRuns

func (v *BackendRemoteHuman) WaitingForQueuedRuns(noOfRuns int, elapsedHint string)

func (*BackendRemoteHuman) WaitingForRuns

func (v *BackendRemoteHuman) WaitingForRuns(noOfRuns int, elapsedHint string)

func (*BackendRemoteHuman) WaitingForTheManuallyLockedWorkspace

func (v *BackendRemoteHuman) WaitingForTheManuallyLockedWorkspace(elapsedHint string)

type Basic

type Basic interface {
	Diagnostics(diags tfdiags.Diagnostics)
}

Basic represents the basic view that can perform basic printing actions as showing diagnostics. This is implemented by most of the view implementations and can be used as argument to allow access to the defined basic functionality.

type Console

type Console interface {
	Diagnostics(diags tfdiags.Diagnostics)

	UnsupportedLocalOp()
	Output(result string)

	// Backend returns the non-command view that contains methods to provide
	// progress output for the backend operations.
	Backend() Backend
}

func NewConsole

func NewConsole(args arguments.ViewOptions, view *View) Console

NewConsole returns an initialized Console implementation for the given ViewType.

type ConsoleHuman

type ConsoleHuman struct {
	// contains filtered or unexported fields
}

func (*ConsoleHuman) Backend

func (v *ConsoleHuman) Backend() Backend

func (*ConsoleHuman) Diagnostics

func (v *ConsoleHuman) Diagnostics(diags tfdiags.Diagnostics)

func (*ConsoleHuman) Output

func (v *ConsoleHuman) Output(result string)

func (*ConsoleHuman) UnsupportedLocalOp

func (v *ConsoleHuman) UnsupportedLocalOp()

type ConsoleJSON

type ConsoleJSON struct {
	// contains filtered or unexported fields
}

ConsoleJSON is meant to be used only for the `-json-into` situation. The `console` command with `-json` does not really make sense so this is not allowed.

func (*ConsoleJSON) Backend

func (v *ConsoleJSON) Backend() Backend

func (*ConsoleJSON) Diagnostics

func (v *ConsoleJSON) Diagnostics(diags tfdiags.Diagnostics)

func (*ConsoleJSON) Output

func (v *ConsoleJSON) Output(result string)

func (*ConsoleJSON) UnsupportedLocalOp

func (v *ConsoleJSON) UnsupportedLocalOp()

type ConsoleMulti

type ConsoleMulti []Console

func (ConsoleMulti) Backend

func (m ConsoleMulti) Backend() Backend

func (ConsoleMulti) Diagnostics

func (m ConsoleMulti) Diagnostics(diags tfdiags.Diagnostics)

func (ConsoleMulti) Output

func (m ConsoleMulti) Output(result string)

func (ConsoleMulti) UnsupportedLocalOp

func (m ConsoleMulti) UnsupportedLocalOp()

type DeprecationDiagnosticAllowedSeen

type DeprecationDiagnosticAllowedSeen map[any]any

Used to track duplicate diagnostic entries in DeprecationDiagnosticAllowed()

type Fmt

type Fmt interface {
	Diagnostics(diags tfdiags.Diagnostics)
	UserOutputWriter() io.Writer
}

func NewFmt

func NewFmt(view *View) Fmt

NewFmt returns an initialized Fmt implementation.

type FmtHuman

type FmtHuman struct {
	// contains filtered or unexported fields
}

func (*FmtHuman) Diagnostics

func (v *FmtHuman) Diagnostics(diags tfdiags.Diagnostics)

func (*FmtHuman) UserOutputWriter

func (v *FmtHuman) UserOutputWriter() io.Writer

UserOutputWriter returns a io.Writer that uses the [FmtHuman.view] as a proxy to write the user facing information during formatting.

type Get

type Get interface {
	Diagnostics(diags tfdiags.Diagnostics)
	Hooks(showLocalDir bool) initwd.ModuleInstallHooks
}

func NewGet

func NewGet(args arguments.ViewOptions, view *View) Get

NewGet returns an initialized Get implementation for the given ViewType.

type GetHuman

type GetHuman struct {
	// contains filtered or unexported fields
}

func (*GetHuman) Diagnostics

func (v *GetHuman) Diagnostics(diags tfdiags.Diagnostics)

func (*GetHuman) Hooks

func (v *GetHuman) Hooks(showLocalPath bool) initwd.ModuleInstallHooks

type GetJSON

type GetJSON struct {
	// contains filtered or unexported fields
}

func (*GetJSON) Diagnostics

func (v *GetJSON) Diagnostics(diags tfdiags.Diagnostics)

func (*GetJSON) Hooks

func (v *GetJSON) Hooks(showLocalPath bool) initwd.ModuleInstallHooks

type GetMulti

type GetMulti []Get

func (GetMulti) Diagnostics

func (m GetMulti) Diagnostics(diags tfdiags.Diagnostics)

func (GetMulti) Hooks

func (m GetMulti) Hooks(showLocalPath bool) initwd.ModuleInstallHooks

type Graph

type Graph interface {
	Diagnostics(diags tfdiags.Diagnostics)
	ErrorUnsupportedLocalOp()
	Output(graphStr string)

	// Backend returns the non-command view that contains methods to provide
	// progress output for the backend operations.
	Backend() Backend
}

func NewGraph

func NewGraph(view *View) Graph

NewGraph returns an initialized Graph implementation for the given ViewType.

type GraphHuman

type GraphHuman struct {
	// contains filtered or unexported fields
}

func (*GraphHuman) Backend

func (v *GraphHuman) Backend() Backend

func (*GraphHuman) Diagnostics

func (v *GraphHuman) Diagnostics(diags tfdiags.Diagnostics)

func (*GraphHuman) ErrorUnsupportedLocalOp

func (v *GraphHuman) ErrorUnsupportedLocalOp()

func (*GraphHuman) Output

func (v *GraphHuman) Output(graphStr string)

type Import

type Import interface {
	Diagnostics(diags tfdiags.Diagnostics)
	Hooks() []tofu.Hook
	Operation() Operation

	InvalidAddressReference()
	MissingResourceConfiguration(addr addrs.AbsResourceInstance, modulePath string, resourceType string, resourceName string)
	Success()
	UnsupportedLocalOp()

	// Backend returns the non-command view that contains methods to provide
	// progress output for the backend operations.
	Backend() Backend
}

func NewImport

func NewImport(args arguments.ViewOptions, view *View) Import

NewImport returns an initialized Import implementation for the given ViewType.

type ImportHuman

type ImportHuman struct {
	// contains filtered or unexported fields
}

The ImportHuman implementation renders messages in a human-readable form.

func (*ImportHuman) Backend

func (v *ImportHuman) Backend() Backend

func (*ImportHuman) Diagnostics

func (v *ImportHuman) Diagnostics(diags tfdiags.Diagnostics)

func (*ImportHuman) Hooks

func (v *ImportHuman) Hooks() []tofu.Hook

func (*ImportHuman) InvalidAddressReference

func (v *ImportHuman) InvalidAddressReference()

func (*ImportHuman) MissingResourceConfiguration

func (v *ImportHuman) MissingResourceConfiguration(addr addrs.AbsResourceInstance, modulePath string, resourceType string, resourceName string)

func (*ImportHuman) Operation

func (v *ImportHuman) Operation() Operation

func (*ImportHuman) Success

func (v *ImportHuman) Success()

func (*ImportHuman) UnsupportedLocalOp

func (v *ImportHuman) UnsupportedLocalOp()

type ImportJSON

type ImportJSON struct {
	// contains filtered or unexported fields
}

func (*ImportJSON) Backend

func (v *ImportJSON) Backend() Backend

func (*ImportJSON) Diagnostics

func (v *ImportJSON) Diagnostics(diags tfdiags.Diagnostics)

func (*ImportJSON) Hooks

func (v *ImportJSON) Hooks() []tofu.Hook

func (*ImportJSON) InvalidAddressReference

func (v *ImportJSON) InvalidAddressReference()

func (*ImportJSON) MissingResourceConfiguration

func (v *ImportJSON) MissingResourceConfiguration(addr addrs.AbsResourceInstance, modulePath string, _ string, _ string)

func (*ImportJSON) Operation

func (v *ImportJSON) Operation() Operation

func (*ImportJSON) Success

func (v *ImportJSON) Success()

func (*ImportJSON) UnsupportedLocalOp

func (v *ImportJSON) UnsupportedLocalOp()

type ImportMulti

type ImportMulti []Import

func (ImportMulti) Backend

func (m ImportMulti) Backend() Backend

func (ImportMulti) Diagnostics

func (m ImportMulti) Diagnostics(diags tfdiags.Diagnostics)

func (ImportMulti) Hooks

func (m ImportMulti) Hooks() []tofu.Hook

func (ImportMulti) InvalidAddressReference

func (m ImportMulti) InvalidAddressReference()

func (ImportMulti) MissingResourceConfiguration

func (m ImportMulti) MissingResourceConfiguration(addr addrs.AbsResourceInstance, modulePath string, resourceType string, resourceName string)

func (ImportMulti) Operation

func (m ImportMulti) Operation() Operation

func (ImportMulti) Success

func (m ImportMulti) Success()

func (ImportMulti) UnsupportedLocalOp

func (m ImportMulti) UnsupportedLocalOp()

type Init

type Init interface {
	CopyFromModule(src string)
	InitialisedFromEmptyDir()

	Diagnostics(diags tfdiags.Diagnostics)

	ConfigError()
	OutputNewline()
	InitSuccess(cloud bool)
	InitSuccessCLI(cloud bool)

	InitializingModules(upgrade bool)

	InitializingProviderPlugins()
	ProviderAlreadyInstalled(provider string, version string, inCache bool)
	BuiltInProviderAvailable(provider string)
	ReusingLockFileVersion(provider string)
	FindingProviderVersions(provider string, constraints string)
	FindingLatestProviderVersion(provider string)
	UsingProviderFromCache(provider string, version string)
	InstallingProvider(provider string, version string, toCache bool)
	ProviderInstalled(provider string, version string, authResult string, keyID string)
	ProviderInstalledSkippedSignature(provider string, version string)
	WaitingForCacheLock(cacheDir string)
	ProvidersSignedInfo()
	ProviderUpgradeLockfileConflict()
	ProviderInstallationInterrupted()
	LockFileCreated()
	LockFileChanged()
	Hooks(showLocalDir bool) initwd.ModuleInstallHooks

	// Backend returns the non-command view that contains methods to provide
	// progress output for the backend operations.
	Backend() Backend
}

func NewInit

func NewInit(args arguments.ViewOptions, view *View) Init

NewInit returns an initialized Init implementation for the given ViewType.

type InitHuman

type InitHuman struct {
	// contains filtered or unexported fields
}

func (*InitHuman) Backend

func (v *InitHuman) Backend() Backend

func (*InitHuman) BuiltInProviderAvailable

func (v *InitHuman) BuiltInProviderAvailable(provider string)

func (*InitHuman) ConfigError

func (v *InitHuman) ConfigError()

func (*InitHuman) CopyFromModule

func (v *InitHuman) CopyFromModule(src string)

func (*InitHuman) Diagnostics

func (v *InitHuman) Diagnostics(diags tfdiags.Diagnostics)

func (*InitHuman) FindingLatestProviderVersion

func (v *InitHuman) FindingLatestProviderVersion(provider string)

func (*InitHuman) FindingProviderVersions

func (v *InitHuman) FindingProviderVersions(provider string, constraints string)

func (*InitHuman) Hooks

func (v *InitHuman) Hooks(showLocalPath bool) initwd.ModuleInstallHooks

func (*InitHuman) InitSuccess

func (v *InitHuman) InitSuccess(cloud bool)

func (*InitHuman) InitSuccessCLI

func (v *InitHuman) InitSuccessCLI(cloud bool)

func (*InitHuman) InitialisedFromEmptyDir

func (v *InitHuman) InitialisedFromEmptyDir()

func (*InitHuman) InitializingModules

func (v *InitHuman) InitializingModules(upgrade bool)

func (*InitHuman) InitializingProviderPlugins

func (v *InitHuman) InitializingProviderPlugins()

func (*InitHuman) InstallingProvider

func (v *InitHuman) InstallingProvider(provider string, version string, toCache bool)

func (*InitHuman) LockFileChanged

func (v *InitHuman) LockFileChanged()

func (*InitHuman) LockFileCreated

func (v *InitHuman) LockFileCreated()

func (*InitHuman) OutputNewline

func (v *InitHuman) OutputNewline()

func (*InitHuman) ProviderAlreadyInstalled

func (v *InitHuman) ProviderAlreadyInstalled(provider string, version string, inCache bool)

func (*InitHuman) ProviderInstallationInterrupted

func (v *InitHuman) ProviderInstallationInterrupted()

func (*InitHuman) ProviderInstalled

func (v *InitHuman) ProviderInstalled(provider string, version string, authResult string, keyID string)

func (*InitHuman) ProviderInstalledSkippedSignature

func (v *InitHuman) ProviderInstalledSkippedSignature(provider string, version string)

func (*InitHuman) ProviderUpgradeLockfileConflict

func (v *InitHuman) ProviderUpgradeLockfileConflict()

func (*InitHuman) ProvidersSignedInfo

func (v *InitHuman) ProvidersSignedInfo()

func (*InitHuman) ReusingLockFileVersion

func (v *InitHuman) ReusingLockFileVersion(provider string)

func (*InitHuman) UsingProviderFromCache

func (v *InitHuman) UsingProviderFromCache(provider string, version string)

func (*InitHuman) WaitingForCacheLock

func (v *InitHuman) WaitingForCacheLock(cacheDir string)

type InitJSON

type InitJSON struct {
	// contains filtered or unexported fields
}

func (*InitJSON) Backend

func (v *InitJSON) Backend() Backend

func (*InitJSON) BuiltInProviderAvailable

func (v *InitJSON) BuiltInProviderAvailable(provider string)

func (*InitJSON) ConfigError

func (v *InitJSON) ConfigError()

func (*InitJSON) CopyFromModule

func (v *InitJSON) CopyFromModule(src string)

func (*InitJSON) Diagnostics

func (v *InitJSON) Diagnostics(diags tfdiags.Diagnostics)

func (*InitJSON) FindingLatestProviderVersion

func (v *InitJSON) FindingLatestProviderVersion(provider string)

func (*InitJSON) FindingProviderVersions

func (v *InitJSON) FindingProviderVersions(provider string, constraints string)

func (*InitJSON) Hooks

func (v *InitJSON) Hooks(showLocalPath bool) initwd.ModuleInstallHooks

func (*InitJSON) InitSuccess

func (v *InitJSON) InitSuccess(cloud bool)

func (*InitJSON) InitSuccessCLI

func (v *InitJSON) InitSuccessCLI(cloud bool)

func (*InitJSON) InitialisedFromEmptyDir

func (v *InitJSON) InitialisedFromEmptyDir()

func (*InitJSON) InitializingModules

func (v *InitJSON) InitializingModules(upgrade bool)

func (*InitJSON) InitializingProviderPlugins

func (v *InitJSON) InitializingProviderPlugins()

func (*InitJSON) InstallingProvider

func (v *InitJSON) InstallingProvider(provider string, version string, toCache bool)

func (*InitJSON) LockFileChanged

func (v *InitJSON) LockFileChanged()

func (*InitJSON) LockFileCreated

func (v *InitJSON) LockFileCreated()

func (*InitJSON) OutputNewline

func (v *InitJSON) OutputNewline()

func (*InitJSON) ProviderAlreadyInstalled

func (v *InitJSON) ProviderAlreadyInstalled(provider string, version string, inCache bool)

func (*InitJSON) ProviderInstallationInterrupted

func (v *InitJSON) ProviderInstallationInterrupted()

func (*InitJSON) ProviderInstalled

func (v *InitJSON) ProviderInstalled(provider string, version string, authResult string, keyID string)

func (*InitJSON) ProviderInstalledSkippedSignature

func (v *InitJSON) ProviderInstalledSkippedSignature(provider string, version string)

func (*InitJSON) ProviderUpgradeLockfileConflict

func (v *InitJSON) ProviderUpgradeLockfileConflict()

func (*InitJSON) ProvidersSignedInfo

func (v *InitJSON) ProvidersSignedInfo()

func (*InitJSON) ReusingLockFileVersion

func (v *InitJSON) ReusingLockFileVersion(provider string)

func (*InitJSON) UsingProviderFromCache

func (v *InitJSON) UsingProviderFromCache(provider string, version string)

func (*InitJSON) WaitingForCacheLock

func (v *InitJSON) WaitingForCacheLock(cacheDir string)

type InitMulti

type InitMulti []Init

func (InitMulti) Backend

func (m InitMulti) Backend() Backend

func (InitMulti) BuiltInProviderAvailable

func (m InitMulti) BuiltInProviderAvailable(provider string)

func (InitMulti) ConfigError

func (m InitMulti) ConfigError()

func (InitMulti) CopyFromModule

func (m InitMulti) CopyFromModule(src string)

func (InitMulti) Diagnostics

func (m InitMulti) Diagnostics(diags tfdiags.Diagnostics)

func (InitMulti) FindingLatestProviderVersion

func (m InitMulti) FindingLatestProviderVersion(provider string)

func (InitMulti) FindingProviderVersions

func (m InitMulti) FindingProviderVersions(provider string, constraints string)

func (InitMulti) Hooks

func (m InitMulti) Hooks(showLocalPath bool) initwd.ModuleInstallHooks

func (InitMulti) InitSuccess

func (m InitMulti) InitSuccess(cloud bool)

func (InitMulti) InitSuccessCLI

func (m InitMulti) InitSuccessCLI(cloud bool)

func (InitMulti) InitialisedFromEmptyDir

func (m InitMulti) InitialisedFromEmptyDir()

func (InitMulti) InitializingModules

func (m InitMulti) InitializingModules(upgrade bool)

func (InitMulti) InitializingProviderPlugins

func (m InitMulti) InitializingProviderPlugins()

func (InitMulti) InstallingProvider

func (m InitMulti) InstallingProvider(provider string, version string, toCache bool)

func (InitMulti) LockFileChanged

func (m InitMulti) LockFileChanged()

func (InitMulti) LockFileCreated

func (m InitMulti) LockFileCreated()

func (InitMulti) OutputNewline

func (m InitMulti) OutputNewline()

func (InitMulti) ProviderAlreadyInstalled

func (m InitMulti) ProviderAlreadyInstalled(provider string, version string, inCache bool)

func (InitMulti) ProviderInstallationInterrupted

func (m InitMulti) ProviderInstallationInterrupted()

func (InitMulti) ProviderInstalled

func (m InitMulti) ProviderInstalled(provider string, version string, authResult string, keyID string)

func (InitMulti) ProviderInstalledSkippedSignature

func (m InitMulti) ProviderInstalledSkippedSignature(provider string, version string)

func (InitMulti) ProviderUpgradeLockfileConflict

func (m InitMulti) ProviderUpgradeLockfileConflict()

func (InitMulti) ProvidersSignedInfo

func (m InitMulti) ProvidersSignedInfo()

func (InitMulti) ReusingLockFileVersion

func (m InitMulti) ReusingLockFileVersion(provider string)

func (InitMulti) UsingProviderFromCache

func (m InitMulti) UsingProviderFromCache(provider string, version string)

func (InitMulti) WaitingForCacheLock

func (m InitMulti) WaitingForCacheLock(cacheDir string)

type JSONView

type JSONView struct {
	// contains filtered or unexported fields
}

func NewJSONView

func NewJSONView(view *View, out *os.File) *JSONView

NewJSONView creates a new JSONView that wraps the logger configured for the JSON output. This method is meant to be called only from the views that are root level, meaning that are created for the invoked OpenTofu command. The other utilitary views (eg: Backend, StateLocker, jsonHook, etc) needs to get JSONView from a root level view. That's because when this method is called, it prints a log entry with the OpenTofu version. By invoking this method multiple times in a run, will produce multiple version log entries, which might disrupt any other external parsing tool that might rely on the machine readable output.

func (*JSONView) ChangeSummary

func (v *JSONView) ChangeSummary(cs *json.ChangeSummary)

func (*JSONView) Diagnostics

func (v *JSONView) Diagnostics(diags tfdiags.Diagnostics, metadata ...any)

func (*JSONView) Error

func (v *JSONView) Error(message string)

Error is designed for supporting command.WrappedUi

func (*JSONView) Hook

func (v *JSONView) Hook(h json.Hook)

func (*JSONView) Info

func (v *JSONView) Info(message string)

Info is designed for supporting command.WrappedUi

func (*JSONView) Log

func (v *JSONView) Log(message string)

func (*JSONView) Output

func (v *JSONView) Output(message string)

Output is designed for supporting command.WrappedUi

func (*JSONView) Outputs

func (v *JSONView) Outputs(outputs jsonentities.Outputs)

func (*JSONView) PlannedChange

func (v *JSONView) PlannedChange(c *jsonentities.ResourceInstanceChange)

func (*JSONView) ResourceDrift

func (v *JSONView) ResourceDrift(c *jsonentities.ResourceInstanceChange)

func (*JSONView) StateDump

func (v *JSONView) StateDump(state string)

func (*JSONView) Version

func (v *JSONView) Version()

func (*JSONView) Warn

func (v *JSONView) Warn(message string)

Warn is designed for supporting command.WrappedUi

type LiveCheck added in v0.3.0

type LiveCheck interface {
	Report(rep LiveCheckReport)
}

LiveCheck renders what "choudoufu live-check" prints. Diagnostics do not come through here; they go to View like every other command's.

func NewLiveCheck added in v0.3.0

func NewLiveCheck(view *View) LiveCheck

NewLiveCheck returns the human-readable implementation. There is no JSON implementation: the other consumer of this analysis, tools/corpus-gen, calls internal/live/check directly rather than parsing command output.

type LiveCheckCount added in v0.3.0

type LiveCheckCount struct {
	Label string
	Count int
}

LiveCheckCount is a labelled count: a resource type's share of a type-shaped refusal, or a warning and how often it fired.

type LiveCheckFinding added in v0.3.0

type LiveCheckFinding struct {
	// Title is the refusal's one-line summary, and Layer which pass
	// produced it.
	Title string
	Layer string

	// SiteCount is how many places it fired, which may exceed the number of
	// Examples.
	SiteCount int

	// Types is the per-resource-type breakdown for a type-shaped rule, and
	// is empty for every other rule. When it is set it replaces Examples in
	// the output: a rule that fires on four hundred resources of nine types
	// is read as nine lines, not four hundred.
	Types []LiveCheckCount

	// Examples are the first few positions, as "file:line" and an address.
	Examples []LiveCheckSite

	// MoreSites is how many positions were not shown.
	MoreSites int

	// Remedy is what to do about it, and DocsRef the shipped document that
	// explains it. An empty DocsRef is printed as the gap it is rather than
	// omitted.
	Remedy  string
	DocsRef string

	// UnsetVarRefs are the valueless input variables this refusal's sites
	// read, and UnsetVarSites how many of its sites read one.
	UnsetVarRefs  []string
	UnsetVarSites int
}

LiveCheckFinding is one refusal and where it fired.

type LiveCheckHuman added in v0.3.0

type LiveCheckHuman struct {
	// contains filtered or unexported fields
}

LiveCheckHuman writes the verdict to the view's output stream.

func (*LiveCheckHuman) Report added in v0.3.0

func (v *LiveCheckHuman) Report(rep LiveCheckReport)

Report prints the verdict, then what stops it, then what to do about each, then what was not checked.

The last section is not optional and is not conditional on the verdict. It is the one a reader of a clean report most needs, because a clean report covers three of the six live-path stages and would otherwise read as a promise about the other three.

type LiveCheckModule added in v0.3.0

type LiveCheckModule struct {
	Path   string
	Source string
}

LiveCheckModule is one module call that could not be read.

type LiveCheckReport added in v0.3.0

type LiveCheckReport struct {
	// Dir is the directory that was checked, as the user named it.
	Dir string

	// Blocked is whether anything refused the configuration.
	Blocked bool

	// Instances is how many managed resource instances resolved, and Sites
	// how many refused positions were found.
	Instances int
	Sites     int

	// Findings are the refusals, already ranked.
	Findings []LiveCheckFinding

	// Warnings are non-fatal diagnostics, as a title and a count each.
	Warnings []LiveCheckCount

	// Checked, Partial and Unchecked name the live-path stages behind this
	// verdict: the ones run in full, the ones run in part, and the ones
	// nobody looked at. All three are always printed: see
	// [LiveCheckHuman.Report].
	Checked   []string
	Partial   []string
	Unchecked []string

	// Schemas is whether provider schemas were available.
	Schemas bool

	// UnresolvedModules are module calls whose contents went unchecked.
	UnresolvedModules []LiveCheckModule

	// UnsetVariables are required input variables that had no value.
	UnsetVariables []string

	// VariableDependentFindings is how many refusals have at least one site
	// reading an unset variable, and FullyVariableDependent how many have
	// no other kind of site. The second is the number that would go away if
	// the variables were supplied; the first is the number that might
	// change. Issue #161.
	VariableDependentFindings int
	FullyVariableDependent    int

	// OnlyBackendRemains is true when the configuration is not blocked and
	// the only warning is the state-backend rule: the sole remaining
	// friction is a backend or cloud block, which choudoufu ignores rather
	// than reads. Deleting it is still the recommended edit - so the
	// configuration says what actually happens - though it is not required.
	//
	// Before #214 demoted state-backend from a fatal finding to a warning,
	// this named the "one edit from moving" case (#175): 11 of 145 real
	// published estates were blocked on exactly this rule and nothing else.
	// That case cannot occur anymore - state-backend never reaches
	// Findings, so it can no longer be what blocks a configuration - but the
	// clean verdict it now describes is still worth calling out by name
	// rather than folding into an unqualified "nothing is refused".
	OnlyBackendRemains bool
}

LiveCheckReport is one configuration's verdict, in a form this package can render without importing internal/live/check.

It follows StatelessMvReport's convention for the same reason: the analysis package decides what is true, and this package decides how it reads. The fields are already-decided facts - the ranking, the site cap and the type summarization all happen before a report gets here.

type LiveCheckSite added in v0.3.0

type LiveCheckSite struct {
	Location string
	Address  string
}

LiveCheckSite is one position.

type Login

type Login interface {
	Diagnostics(diags tfdiags.Diagnostics)

	UiSeparator()
	MOTDMessage(msg string)
	DefaultTFCLoginSuccess()
	DefaultTFELoginSuccess(dispHostname string)
	TokenObtainedConfirmation(dispHostname string)
	OpeningBrowserForOAuth(dispHostname, authCodeURL string)
	ManualBrowserLaunch(dispHostname, authCodeURL string)
	WaitingForHostSignal()
	PasswordRequestHeader()
	OpeningBrowserForTokens(dispHostname, tokensURL string)
	ManualBrowserLaunchForTokens(dispHostname, tokensURL string)
	GenerateTokenInstruction()
	TokenStorageInFile(localFilename string)
	TokenStorageInHelper(helperType string)
	RetrievedTokenForUser(username string)
	RequestAPITokenMessage(dispHostname, mechanism string)
	BrowserBasedLoginInstruction()
	StorageLocationConsentInHelper(helperType string)
	StorageLocationConsentInFile(localFilename string)
}

func NewLogin

func NewLogin(args arguments.ViewOptions, view *View) Login

NewLogin returns an initialized Login implementation for the given ViewType.

type LoginHuman

type LoginHuman struct {
	// contains filtered or unexported fields
}

func (*LoginHuman) BrowserBasedLoginInstruction

func (v *LoginHuman) BrowserBasedLoginInstruction()

func (*LoginHuman) DefaultTFCLoginSuccess

func (v *LoginHuman) DefaultTFCLoginSuccess()

func (*LoginHuman) DefaultTFELoginSuccess

func (v *LoginHuman) DefaultTFELoginSuccess(dispHostname string)

func (*LoginHuman) Diagnostics

func (v *LoginHuman) Diagnostics(diags tfdiags.Diagnostics)

func (*LoginHuman) GenerateTokenInstruction

func (v *LoginHuman) GenerateTokenInstruction()

func (*LoginHuman) MOTDMessage

func (v *LoginHuman) MOTDMessage(msg string)

func (*LoginHuman) ManualBrowserLaunch

func (v *LoginHuman) ManualBrowserLaunch(dispHostname, authCodeURL string)

func (*LoginHuman) ManualBrowserLaunchForTokens

func (v *LoginHuman) ManualBrowserLaunchForTokens(dispHostname, tokensURL string)

func (*LoginHuman) OpeningBrowserForOAuth

func (v *LoginHuman) OpeningBrowserForOAuth(dispHostname, authCodeURL string)

func (*LoginHuman) OpeningBrowserForTokens

func (v *LoginHuman) OpeningBrowserForTokens(dispHostname, tokensURL string)

func (*LoginHuman) PasswordRequestHeader

func (v *LoginHuman) PasswordRequestHeader()

func (*LoginHuman) RequestAPITokenMessage

func (v *LoginHuman) RequestAPITokenMessage(dispHostname, mechanism string)

func (*LoginHuman) RetrievedTokenForUser

func (v *LoginHuman) RetrievedTokenForUser(username string)

func (*LoginHuman) StorageLocationConsentInFile

func (v *LoginHuman) StorageLocationConsentInFile(localFilename string)

func (*LoginHuman) StorageLocationConsentInHelper

func (v *LoginHuman) StorageLocationConsentInHelper(helperType string)

func (*LoginHuman) TokenObtainedConfirmation

func (v *LoginHuman) TokenObtainedConfirmation(dispHostname string)

func (*LoginHuman) TokenStorageInFile

func (v *LoginHuman) TokenStorageInFile(localFilename string)

func (*LoginHuman) TokenStorageInHelper

func (v *LoginHuman) TokenStorageInHelper(helperType string)

func (*LoginHuman) UiSeparator

func (v *LoginHuman) UiSeparator()

func (*LoginHuman) WaitingForHostSignal

func (v *LoginHuman) WaitingForHostSignal()

type LoginJSON

type LoginJSON struct {
	// contains filtered or unexported fields
}

func (*LoginJSON) BrowserBasedLoginInstruction

func (v *LoginJSON) BrowserBasedLoginInstruction()

func (*LoginJSON) DefaultTFCLoginSuccess

func (v *LoginJSON) DefaultTFCLoginSuccess()

func (*LoginJSON) DefaultTFELoginSuccess

func (v *LoginJSON) DefaultTFELoginSuccess(dispHostname string)

func (*LoginJSON) Diagnostics

func (v *LoginJSON) Diagnostics(diags tfdiags.Diagnostics)

func (*LoginJSON) GenerateTokenInstruction

func (v *LoginJSON) GenerateTokenInstruction()

func (*LoginJSON) MOTDMessage

func (v *LoginJSON) MOTDMessage(msg string)

func (*LoginJSON) ManualBrowserLaunch

func (v *LoginJSON) ManualBrowserLaunch(dispHostname, authCodeURL string)

func (*LoginJSON) ManualBrowserLaunchForTokens

func (v *LoginJSON) ManualBrowserLaunchForTokens(dispHostname, tokensURL string)

func (*LoginJSON) OpeningBrowserForOAuth

func (v *LoginJSON) OpeningBrowserForOAuth(dispHostname, authCodeURL string)

func (*LoginJSON) OpeningBrowserForTokens

func (v *LoginJSON) OpeningBrowserForTokens(dispHostname, tokensURL string)

func (*LoginJSON) PasswordRequestHeader

func (v *LoginJSON) PasswordRequestHeader()

func (*LoginJSON) RequestAPITokenMessage

func (v *LoginJSON) RequestAPITokenMessage(dispHostname, mechanism string)

func (*LoginJSON) RetrievedTokenForUser

func (v *LoginJSON) RetrievedTokenForUser(username string)

func (*LoginJSON) StorageLocationConsentInFile

func (v *LoginJSON) StorageLocationConsentInFile(localFilename string)

func (*LoginJSON) StorageLocationConsentInHelper

func (v *LoginJSON) StorageLocationConsentInHelper(helperType string)

func (*LoginJSON) TokenObtainedConfirmation

func (v *LoginJSON) TokenObtainedConfirmation(dispHostname string)

func (*LoginJSON) TokenStorageInFile

func (v *LoginJSON) TokenStorageInFile(localFilename string)

func (*LoginJSON) TokenStorageInHelper

func (v *LoginJSON) TokenStorageInHelper(helperType string)

func (*LoginJSON) UiSeparator

func (v *LoginJSON) UiSeparator()

func (*LoginJSON) WaitingForHostSignal

func (v *LoginJSON) WaitingForHostSignal()

type LoginMulti

type LoginMulti []Login

func (LoginMulti) BrowserBasedLoginInstruction

func (m LoginMulti) BrowserBasedLoginInstruction()

func (LoginMulti) DefaultTFCLoginSuccess

func (m LoginMulti) DefaultTFCLoginSuccess()

func (LoginMulti) DefaultTFELoginSuccess

func (m LoginMulti) DefaultTFELoginSuccess(dispHostname string)

func (LoginMulti) Diagnostics

func (m LoginMulti) Diagnostics(diags tfdiags.Diagnostics)

func (LoginMulti) GenerateTokenInstruction

func (m LoginMulti) GenerateTokenInstruction()

func (LoginMulti) MOTDMessage

func (m LoginMulti) MOTDMessage(msg string)

func (LoginMulti) ManualBrowserLaunch

func (m LoginMulti) ManualBrowserLaunch(dispHostname, authCodeURL string)

func (LoginMulti) ManualBrowserLaunchForTokens

func (m LoginMulti) ManualBrowserLaunchForTokens(dispHostname, tokensURL string)

func (LoginMulti) OpeningBrowserForOAuth

func (m LoginMulti) OpeningBrowserForOAuth(dispHostname, authCodeURL string)

func (LoginMulti) OpeningBrowserForTokens

func (m LoginMulti) OpeningBrowserForTokens(dispHostname, tokensURL string)

func (LoginMulti) PasswordRequestHeader

func (m LoginMulti) PasswordRequestHeader()

func (LoginMulti) RequestAPITokenMessage

func (m LoginMulti) RequestAPITokenMessage(dispHostname, mechanism string)

func (LoginMulti) RetrievedTokenForUser

func (m LoginMulti) RetrievedTokenForUser(username string)

func (LoginMulti) StorageLocationConsentInFile

func (m LoginMulti) StorageLocationConsentInFile(localFilename string)

func (LoginMulti) StorageLocationConsentInHelper

func (m LoginMulti) StorageLocationConsentInHelper(helperType string)

func (LoginMulti) TokenObtainedConfirmation

func (m LoginMulti) TokenObtainedConfirmation(dispHostname string)

func (LoginMulti) TokenStorageInFile

func (m LoginMulti) TokenStorageInFile(localFilename string)

func (LoginMulti) TokenStorageInHelper

func (m LoginMulti) TokenStorageInHelper(helperType string)

func (LoginMulti) UiSeparator

func (m LoginMulti) UiSeparator()

func (LoginMulti) WaitingForHostSignal

func (m LoginMulti) WaitingForHostSignal()

type Logout

type Logout interface {
	Diagnostics(diags tfdiags.Diagnostics)

	NoCredentialsStored(dispHostname string)
	RemovingCredentialsFromHelper(dispHostname, helperType string)
	RemovingCredentialsFromFile(dispHostname, localFilename string)
	LogoutSuccess(dispHostname string)
}

func NewLogout

func NewLogout(args arguments.ViewOptions, view *View) Logout

NewLogout returns an initialized Logout implementation for the given ViewType.

type LogoutHuman

type LogoutHuman struct {
	// contains filtered or unexported fields
}

func (*LogoutHuman) Diagnostics

func (v *LogoutHuman) Diagnostics(diags tfdiags.Diagnostics)

func (*LogoutHuman) LogoutSuccess

func (v *LogoutHuman) LogoutSuccess(dispHostname string)

func (*LogoutHuman) NoCredentialsStored

func (v *LogoutHuman) NoCredentialsStored(dispHostname string)

func (*LogoutHuman) RemovingCredentialsFromFile

func (v *LogoutHuman) RemovingCredentialsFromFile(dispHostname, localFilename string)

func (*LogoutHuman) RemovingCredentialsFromHelper

func (v *LogoutHuman) RemovingCredentialsFromHelper(dispHostname, helperType string)

type LogoutJSON

type LogoutJSON struct {
	// contains filtered or unexported fields
}

func (*LogoutJSON) Diagnostics

func (v *LogoutJSON) Diagnostics(diags tfdiags.Diagnostics)

func (*LogoutJSON) LogoutSuccess

func (v *LogoutJSON) LogoutSuccess(dispHostname string)

func (*LogoutJSON) NoCredentialsStored

func (v *LogoutJSON) NoCredentialsStored(dispHostname string)

func (*LogoutJSON) RemovingCredentialsFromFile

func (v *LogoutJSON) RemovingCredentialsFromFile(dispHostname, localFilename string)

func (*LogoutJSON) RemovingCredentialsFromHelper

func (v *LogoutJSON) RemovingCredentialsFromHelper(dispHostname, helperType string)

type LogoutMulti

type LogoutMulti []Logout

func (LogoutMulti) Diagnostics

func (m LogoutMulti) Diagnostics(diags tfdiags.Diagnostics)

func (LogoutMulti) LogoutSuccess

func (m LogoutMulti) LogoutSuccess(dispHostname string)

func (LogoutMulti) NoCredentialsStored

func (m LogoutMulti) NoCredentialsStored(dispHostname string)

func (LogoutMulti) RemovingCredentialsFromFile

func (m LogoutMulti) RemovingCredentialsFromFile(dispHostname, localFilename string)

func (LogoutMulti) RemovingCredentialsFromHelper

func (m LogoutMulti) RemovingCredentialsFromHelper(dispHostname, helperType string)

type MetadataFunctions

type MetadataFunctions interface {
	Diagnostics(diags tfdiags.Diagnostics)
	// PrintFunctions returns true if it managed to print the functions and false otherwise.
	PrintFunctions() bool
}

func NewMetadataFunctions

func NewMetadataFunctions(view *View) MetadataFunctions

NewMetadataFunctions returns an initialized MetadataFunctions implementation for the given ViewType. In case of this command, the returned MetadataFunctions will always print the diagnostics in human format and the functions in JSON format.

type MetadataFunctionsMixed

type MetadataFunctionsMixed struct {
	// contains filtered or unexported fields
}

func (*MetadataFunctionsMixed) Diagnostics

func (v *MetadataFunctionsMixed) Diagnostics(diags tfdiags.Diagnostics)

func (*MetadataFunctionsMixed) PrintFunctions

func (v *MetadataFunctionsMixed) PrintFunctions() bool

type Operation

type Operation interface {
	Interrupted()
	FatalInterrupt()
	Stopping()
	Cancelled(planMode plans.Mode)

	EmergencyDumpState(stateFile *statefile.File, enc encryption.StateEncryption) error

	PlannedChange(change *plans.ResourceInstanceChangeSrc)
	Plan(plan *plans.Plan, schemas *tofu.Schemas)
	PlanNextStep(planPath string, genConfigPath string)

	Diagnostics(diags tfdiags.Diagnostics)
}

Operation provides information for the main operations, like plan, apply, etc.

This makes use of the View.runningInAutomation to know when it's executed by an automated system rather than directly by a command prompt. This is a hint not to produce messages that expect that a user can run a follow-up command, perhaps because OpenTofu is running in some sort of workflow automation tool that abstracts away the exact commands that are being run.

func NewOperation

func NewOperation(vt arguments.ViewType, view *View) Operation

type OperationHuman

type OperationHuman struct {
	// contains filtered or unexported fields
}

func (*OperationHuman) Cancelled

func (v *OperationHuman) Cancelled(planMode plans.Mode)

func (*OperationHuman) Diagnostics

func (v *OperationHuman) Diagnostics(diags tfdiags.Diagnostics)

func (*OperationHuman) EmergencyDumpState

func (v *OperationHuman) EmergencyDumpState(stateFile *statefile.File, enc encryption.StateEncryption) error

func (*OperationHuman) FatalInterrupt

func (v *OperationHuman) FatalInterrupt()

func (*OperationHuman) Interrupted

func (v *OperationHuman) Interrupted()

func (*OperationHuman) Plan

func (v *OperationHuman) Plan(plan *plans.Plan, schemas *tofu.Schemas)

func (*OperationHuman) PlanNextStep

func (v *OperationHuman) PlanNextStep(planPath string, genConfigPath string)

PlanNextStep gives the user some next-steps, unless we're running in an automation tool which is presumed to provide its own UI for further actions.

func (*OperationHuman) PlannedChange

func (v *OperationHuman) PlannedChange(change *plans.ResourceInstanceChangeSrc)

func (*OperationHuman) Stopping

func (v *OperationHuman) Stopping()

type OperationJSON

type OperationJSON struct {
	// contains filtered or unexported fields
}

func (*OperationJSON) Cancelled

func (v *OperationJSON) Cancelled(planMode plans.Mode)

func (*OperationJSON) Diagnostics

func (v *OperationJSON) Diagnostics(diags tfdiags.Diagnostics)

func (*OperationJSON) EmergencyDumpState

func (v *OperationJSON) EmergencyDumpState(stateFile *statefile.File, enc encryption.StateEncryption) error

func (*OperationJSON) FatalInterrupt

func (v *OperationJSON) FatalInterrupt()

func (*OperationJSON) Interrupted

func (v *OperationJSON) Interrupted()

func (*OperationJSON) Plan

func (v *OperationJSON) Plan(plan *plans.Plan, schemas *tofu.Schemas)

Log a change summary and a series of "planned" messages for the changes in the plan.

func (*OperationJSON) PlanNextStep

func (v *OperationJSON) PlanNextStep(planPath string, genConfigPath string)

PlanNextStep does nothing for the JSON view as it is a hook for user-facing output only applicable to human-readable UI.

func (*OperationJSON) PlannedChange

func (v *OperationJSON) PlannedChange(change *plans.ResourceInstanceChangeSrc)

func (*OperationJSON) Stopping

func (v *OperationJSON) Stopping()

type OperationMulti

type OperationMulti []Operation

func (OperationMulti) Cancelled

func (o OperationMulti) Cancelled(planMode plans.Mode)

func (OperationMulti) Diagnostics

func (o OperationMulti) Diagnostics(diags tfdiags.Diagnostics)

func (OperationMulti) EmergencyDumpState

func (o OperationMulti) EmergencyDumpState(stateFile *statefile.File, enc encryption.StateEncryption) error

func (OperationMulti) FatalInterrupt

func (o OperationMulti) FatalInterrupt()

func (OperationMulti) Interrupted

func (o OperationMulti) Interrupted()

func (OperationMulti) Plan

func (o OperationMulti) Plan(plan *plans.Plan, schemas *tofu.Schemas)

func (OperationMulti) PlanNextStep

func (o OperationMulti) PlanNextStep(planPath string, genConfigPath string)

func (OperationMulti) PlannedChange

func (o OperationMulti) PlannedChange(change *plans.ResourceInstanceChangeSrc)

func (OperationMulti) Stopping

func (o OperationMulti) Stopping()

type Output

type Output interface {
	Output(name string, outputs map[string]*states.OutputValue) tfdiags.Diagnostics
	Diagnostics(diags tfdiags.Diagnostics)
}

The Output view renders either one or all outputs, depending on whether or not the name argument is empty.

func NewOutput

func NewOutput(args arguments.ViewOptions, view *View) Output

NewOutput returns an initialized Output implementation for the given ViewType.

type OutputHuman

type OutputHuman struct {
	// contains filtered or unexported fields
}

The OutputHuman implementation renders outputs in a format equivalent to HCL source. This uses the same formatting logic as in the console REPL.

func (*OutputHuman) Diagnostics

func (v *OutputHuman) Diagnostics(diags tfdiags.Diagnostics)

func (*OutputHuman) Output

func (v *OutputHuman) Output(name string, outputs map[string]*states.OutputValue) tfdiags.Diagnostics

type OutputJSON

type OutputJSON struct {
	// contains filtered or unexported fields
}

The OutputJSON implementation renders outputs as JSON values. When rendering a single output, only the value is displayed. When rendering all outputs, the result is a JSON object with keys matching the output names and object values including type and sensitivity metadata.

func (*OutputJSON) Diagnostics

func (v *OutputJSON) Diagnostics(diags tfdiags.Diagnostics)

func (*OutputJSON) Output

func (v *OutputJSON) Output(name string, outputs map[string]*states.OutputValue) tfdiags.Diagnostics

type OutputMulti

type OutputMulti []Output

func (OutputMulti) Diagnostics

func (m OutputMulti) Diagnostics(diags tfdiags.Diagnostics)

func (OutputMulti) Output

func (m OutputMulti) Output(name string, outputs map[string]*states.OutputValue) tfdiags.Diagnostics

type OutputRaw

type OutputRaw struct {
	// contains filtered or unexported fields
}

The OutputRaw implementation renders single string, number, or boolean output values directly and without quotes or other formatting. This is intended for use in shell scripting or other environments where the exact type of an output value is not important.

func (*OutputRaw) Diagnostics

func (v *OutputRaw) Diagnostics(diags tfdiags.Diagnostics)

func (*OutputRaw) Output

func (v *OutputRaw) Output(name string, outputs map[string]*states.OutputValue) tfdiags.Diagnostics

type Plan

type Plan interface {
	Operation() Operation
	Hooks() []tofu.Hook

	Diagnostics(diags tfdiags.Diagnostics)
	HelpPrompt()

	// Backend returns the non-command view that contains methods to provide
	// progress output for the backend operations.
	Backend() Backend
}

The Plan view is used for the plan command.

func NewPlan

func NewPlan(args arguments.ViewOptions, view *View) Plan

NewPlan returns an initialized Plan implementation for the given ViewType.

type PlanHuman

type PlanHuman struct {
	// contains filtered or unexported fields
}

The PlanHuman implementation renders human-readable text logs, suitable for a scrolling terminal.

func (*PlanHuman) Backend

func (v *PlanHuman) Backend() Backend

func (*PlanHuman) Diagnostics

func (v *PlanHuman) Diagnostics(diags tfdiags.Diagnostics)

func (*PlanHuman) HelpPrompt

func (v *PlanHuman) HelpPrompt()

func (*PlanHuman) Hooks

func (v *PlanHuman) Hooks() []tofu.Hook

func (*PlanHuman) Operation

func (v *PlanHuman) Operation() Operation

type PlanJSON

type PlanJSON struct {
	// contains filtered or unexported fields
}

The PlanJSON implementation renders streaming JSON logs, suitable for integrating with other software.

func (*PlanJSON) Backend

func (v *PlanJSON) Backend() Backend

func (*PlanJSON) Diagnostics

func (v *PlanJSON) Diagnostics(diags tfdiags.Diagnostics)

func (*PlanJSON) HelpPrompt

func (v *PlanJSON) HelpPrompt()

func (*PlanJSON) Hooks

func (v *PlanJSON) Hooks() []tofu.Hook

func (*PlanJSON) Operation

func (v *PlanJSON) Operation() Operation

type PlanMulti

type PlanMulti []Plan

func (PlanMulti) Backend

func (m PlanMulti) Backend() Backend

func (PlanMulti) Diagnostics

func (m PlanMulti) Diagnostics(diags tfdiags.Diagnostics)

func (PlanMulti) HelpPrompt

func (m PlanMulti) HelpPrompt()

func (PlanMulti) Hooks

func (m PlanMulti) Hooks() []tofu.Hook

func (PlanMulti) Operation

func (m PlanMulti) Operation() Operation

type Providers

type Providers interface {
	Diagnostics(diags tfdiags.Diagnostics)
	ModuleRequirements(cfg *configs.ModuleRequirements)
	StateRequirements(stateReqs getproviders.Requirements)

	// Backend returns the non-command view that contains methods to provide
	// progress output for the backend operations.
	Backend() Backend
}

func NewProviders

func NewProviders(view *View) Providers

NewProviders returns an initialized Providers implementation for the given ViewType.

type ProvidersHuman

type ProvidersHuman struct {
	// contains filtered or unexported fields
}

func (*ProvidersHuman) Backend

func (v *ProvidersHuman) Backend() Backend

func (*ProvidersHuman) Diagnostics

func (v *ProvidersHuman) Diagnostics(diags tfdiags.Diagnostics)

func (*ProvidersHuman) ModuleRequirements

func (v *ProvidersHuman) ModuleRequirements(reqs *configs.ModuleRequirements)

func (*ProvidersHuman) StateRequirements

func (v *ProvidersHuman) StateRequirements(stateReqs getproviders.Requirements)

type ProvidersLock

type ProvidersLock interface {
	Diagnostics(diags tfdiags.Diagnostics)
	InstallationFetching(provider string, version string, platform string)
	FetchPackageSuccess(keyID string, provider string, version string, platform string, auth string)
	LockUpdateNewProvider(provider string, platform string)
	LockUpdateNewHashForProvider(provider string, platform string)
	LockUpdateNoChange(provider string, platform string)
	UpdatedSuccessfully(madeAnyChange bool)
}

func NewProvidersLock

func NewProvidersLock(args arguments.ViewOptions, view *View) ProvidersLock

NewProvidersLock returns an initialized ProvidersLock implementation for the given ViewType.

type ProvidersLockHuman

type ProvidersLockHuman struct {
	// contains filtered or unexported fields
}

func (*ProvidersLockHuman) Diagnostics

func (v *ProvidersLockHuman) Diagnostics(diags tfdiags.Diagnostics)

func (*ProvidersLockHuman) FetchPackageSuccess

func (v *ProvidersLockHuman) FetchPackageSuccess(keyID string, provider string, version string, platform string, auth string)

func (*ProvidersLockHuman) InstallationFetching

func (v *ProvidersLockHuman) InstallationFetching(provider string, version string, platform string)

func (*ProvidersLockHuman) LockUpdateNewHashForProvider

func (v *ProvidersLockHuman) LockUpdateNewHashForProvider(provider string, platform string)

func (*ProvidersLockHuman) LockUpdateNewProvider

func (v *ProvidersLockHuman) LockUpdateNewProvider(provider string, platform string)

func (*ProvidersLockHuman) LockUpdateNoChange

func (v *ProvidersLockHuman) LockUpdateNoChange(provider string, platform string)

func (*ProvidersLockHuman) UpdatedSuccessfully

func (v *ProvidersLockHuman) UpdatedSuccessfully(madeAnyChange bool)

type ProvidersLockJSON

type ProvidersLockJSON struct {
	// contains filtered or unexported fields
}

func (*ProvidersLockJSON) Diagnostics

func (v *ProvidersLockJSON) Diagnostics(diags tfdiags.Diagnostics)

func (*ProvidersLockJSON) FetchPackageSuccess

func (v *ProvidersLockJSON) FetchPackageSuccess(keyID string, provider string, version string, platform string, auth string)

func (*ProvidersLockJSON) InstallationFetching

func (v *ProvidersLockJSON) InstallationFetching(provider string, version string, platform string)

func (*ProvidersLockJSON) LockUpdateNewHashForProvider

func (v *ProvidersLockJSON) LockUpdateNewHashForProvider(provider string, platform string)

func (*ProvidersLockJSON) LockUpdateNewProvider

func (v *ProvidersLockJSON) LockUpdateNewProvider(provider string, platform string)

func (*ProvidersLockJSON) LockUpdateNoChange

func (v *ProvidersLockJSON) LockUpdateNoChange(provider string, platform string)

func (*ProvidersLockJSON) UpdatedSuccessfully

func (v *ProvidersLockJSON) UpdatedSuccessfully(madeAnyChange bool)

type ProvidersLockMulti

type ProvidersLockMulti []ProvidersLock

func (ProvidersLockMulti) Diagnostics

func (m ProvidersLockMulti) Diagnostics(diags tfdiags.Diagnostics)

func (ProvidersLockMulti) FetchPackageSuccess

func (m ProvidersLockMulti) FetchPackageSuccess(keyID string, provider string, version string, platform string, auth string)

func (ProvidersLockMulti) InstallationFetching

func (m ProvidersLockMulti) InstallationFetching(provider string, version string, platform string)

func (ProvidersLockMulti) LockUpdateNewHashForProvider

func (m ProvidersLockMulti) LockUpdateNewHashForProvider(provider string, platform string)

func (ProvidersLockMulti) LockUpdateNewProvider

func (m ProvidersLockMulti) LockUpdateNewProvider(provider string, platform string)

func (ProvidersLockMulti) LockUpdateNoChange

func (m ProvidersLockMulti) LockUpdateNoChange(provider string, platform string)

func (ProvidersLockMulti) UpdatedSuccessfully

func (m ProvidersLockMulti) UpdatedSuccessfully(madeAnyChange bool)

type ProvidersMirror

type ProvidersMirror interface {
	Diagnostics(diags tfdiags.Diagnostics)
	ProviderSkipped(provider string)
	MirroringProvider(provider string)
	ProviderVersionSelectedToMatchLockfile(provider string, version string)
	ProviderVersionSelectedToMatchConstraints(provider string, version string, constraints string)
	ProviderVersionSelectedWithNoConstraints(provider string, version string)
	DownloadingPackageFor(provider string, version string, platform string)
	PackageAuthenticated(provider string, version string, platform string, authResult string)
}

func NewProvidersMirror

func NewProvidersMirror(args arguments.ViewOptions, view *View) ProvidersMirror

NewProvidersMirror returns an initialized ProvidersMirror implementation for the given ViewType.

type ProvidersMirrorHuman

type ProvidersMirrorHuman struct {
	// contains filtered or unexported fields
}

func (*ProvidersMirrorHuman) Diagnostics

func (v *ProvidersMirrorHuman) Diagnostics(diags tfdiags.Diagnostics)

func (*ProvidersMirrorHuman) DownloadingPackageFor

func (v *ProvidersMirrorHuman) DownloadingPackageFor(_ string, _ string, platform string)

func (*ProvidersMirrorHuman) MirroringProvider

func (v *ProvidersMirrorHuman) MirroringProvider(provider string)

func (*ProvidersMirrorHuman) PackageAuthenticated

func (v *ProvidersMirrorHuman) PackageAuthenticated(_, _, _ string, authResult string)

func (*ProvidersMirrorHuman) ProviderSkipped

func (v *ProvidersMirrorHuman) ProviderSkipped(provider string)

func (*ProvidersMirrorHuman) ProviderVersionSelectedToMatchConstraints

func (v *ProvidersMirrorHuman) ProviderVersionSelectedToMatchConstraints(_ string, version string, constraints string)

func (*ProvidersMirrorHuman) ProviderVersionSelectedToMatchLockfile

func (v *ProvidersMirrorHuman) ProviderVersionSelectedToMatchLockfile(_ string, version string)

func (*ProvidersMirrorHuman) ProviderVersionSelectedWithNoConstraints

func (v *ProvidersMirrorHuman) ProviderVersionSelectedWithNoConstraints(_ string, version string)

type ProvidersMirrorJSON

type ProvidersMirrorJSON struct {
	// contains filtered or unexported fields
}

func (*ProvidersMirrorJSON) Diagnostics

func (v *ProvidersMirrorJSON) Diagnostics(diags tfdiags.Diagnostics)

func (*ProvidersMirrorJSON) DownloadingPackageFor

func (v *ProvidersMirrorJSON) DownloadingPackageFor(provider string, version string, platform string)

func (*ProvidersMirrorJSON) MirroringProvider

func (v *ProvidersMirrorJSON) MirroringProvider(provider string)

func (*ProvidersMirrorJSON) PackageAuthenticated

func (v *ProvidersMirrorJSON) PackageAuthenticated(provider string, version string, platform string, authResult string)

func (*ProvidersMirrorJSON) ProviderSkipped

func (v *ProvidersMirrorJSON) ProviderSkipped(provider string)

func (*ProvidersMirrorJSON) ProviderVersionSelectedToMatchConstraints

func (v *ProvidersMirrorJSON) ProviderVersionSelectedToMatchConstraints(provider string, version string, constraints string)

func (*ProvidersMirrorJSON) ProviderVersionSelectedToMatchLockfile

func (v *ProvidersMirrorJSON) ProviderVersionSelectedToMatchLockfile(provider string, version string)

func (*ProvidersMirrorJSON) ProviderVersionSelectedWithNoConstraints

func (v *ProvidersMirrorJSON) ProviderVersionSelectedWithNoConstraints(provider string, version string)

type ProvidersMirrorMulti

type ProvidersMirrorMulti []ProvidersMirror

func (ProvidersMirrorMulti) Diagnostics

func (m ProvidersMirrorMulti) Diagnostics(diags tfdiags.Diagnostics)

func (ProvidersMirrorMulti) DownloadingPackageFor

func (m ProvidersMirrorMulti) DownloadingPackageFor(provider string, version string, platform string)

func (ProvidersMirrorMulti) MirroringProvider

func (m ProvidersMirrorMulti) MirroringProvider(provider string)

func (ProvidersMirrorMulti) PackageAuthenticated

func (m ProvidersMirrorMulti) PackageAuthenticated(provider string, version string, platform string, authResult string)

func (ProvidersMirrorMulti) ProviderSkipped

func (m ProvidersMirrorMulti) ProviderSkipped(provider string)

func (ProvidersMirrorMulti) ProviderVersionSelectedToMatchConstraints

func (m ProvidersMirrorMulti) ProviderVersionSelectedToMatchConstraints(provider string, version string, constraints string)

func (ProvidersMirrorMulti) ProviderVersionSelectedToMatchLockfile

func (m ProvidersMirrorMulti) ProviderVersionSelectedToMatchLockfile(provider string, version string)

func (ProvidersMirrorMulti) ProviderVersionSelectedWithNoConstraints

func (m ProvidersMirrorMulti) ProviderVersionSelectedWithNoConstraints(provider string, version string)

type ProvidersSchema

type ProvidersSchema interface {
	// Diagnostics is used to render diagnostic messages out to the user.
	Diagnostics(diags tfdiags.Diagnostics)

	// UnsupportedLocalOp is used to output a message to the user that the current operation is unsupported locally.
	UnsupportedLocalOp()

	// Output is used to display the final JSON output of the providers schema map.
	Output(json string)

	// Backend returns the non-command view that contains methods to provide
	// progress output for the backend operations.
	Backend() Backend
}

ProvidersSchema is the interface for the providers schema view.

func NewProvidersSchema

func NewProvidersSchema(v *View) ProvidersSchema

NewProvidersSchema creates a new ProvidersSchema view.

type ProvidersSchemaMixed

type ProvidersSchemaMixed struct {
	// contains filtered or unexported fields
}

func (*ProvidersSchemaMixed) Backend

func (v *ProvidersSchemaMixed) Backend() Backend

func (*ProvidersSchemaMixed) Diagnostics

func (v *ProvidersSchemaMixed) Diagnostics(diags tfdiags.Diagnostics)

func (*ProvidersSchemaMixed) Output

func (v *ProvidersSchemaMixed) Output(json string)

func (*ProvidersSchemaMixed) UnsupportedLocalOp

func (v *ProvidersSchemaMixed) UnsupportedLocalOp()

type Refresh

type Refresh interface {
	Outputs(outputValues map[string]*states.OutputValue)

	Operation() Operation
	Hooks() []tofu.Hook

	Diagnostics(diags tfdiags.Diagnostics)
	HelpPrompt()

	// Backend returns the non-command view that contains methods to provide
	// progress output for the backend operations.
	Backend() Backend
}

The Refresh view is used for the refresh command.

func NewRefresh

func NewRefresh(args arguments.ViewOptions, view *View) Refresh

NewRefresh returns an initialized Refresh implementation for the given ViewType.

type RefreshHuman

type RefreshHuman struct {
	// contains filtered or unexported fields
}

The RefreshHuman implementation renders human-readable text logs, suitable for a scrolling terminal.

func (*RefreshHuman) Backend

func (v *RefreshHuman) Backend() Backend

func (*RefreshHuman) Diagnostics

func (v *RefreshHuman) Diagnostics(diags tfdiags.Diagnostics)

func (*RefreshHuman) HelpPrompt

func (v *RefreshHuman) HelpPrompt()

func (*RefreshHuman) Hooks

func (v *RefreshHuman) Hooks() []tofu.Hook

func (*RefreshHuman) Operation

func (v *RefreshHuman) Operation() Operation

func (*RefreshHuman) Outputs

func (v *RefreshHuman) Outputs(outputValues map[string]*states.OutputValue)

type RefreshJSON

type RefreshJSON struct {
	// contains filtered or unexported fields
}

The RefreshJSON implementation renders streaming JSON logs, suitable for integrating with other software.

func (*RefreshJSON) Backend

func (v *RefreshJSON) Backend() Backend

func (*RefreshJSON) Diagnostics

func (v *RefreshJSON) Diagnostics(diags tfdiags.Diagnostics)

func (*RefreshJSON) HelpPrompt

func (v *RefreshJSON) HelpPrompt()

func (*RefreshJSON) Hooks

func (v *RefreshJSON) Hooks() []tofu.Hook

func (*RefreshJSON) Operation

func (v *RefreshJSON) Operation() Operation

func (*RefreshJSON) Outputs

func (v *RefreshJSON) Outputs(outputValues map[string]*states.OutputValue)

type RefreshMulti

type RefreshMulti []Refresh

func (RefreshMulti) Backend

func (m RefreshMulti) Backend() Backend

func (RefreshMulti) Diagnostics

func (m RefreshMulti) Diagnostics(diags tfdiags.Diagnostics)

func (RefreshMulti) HelpPrompt

func (m RefreshMulti) HelpPrompt()

func (RefreshMulti) Hooks

func (m RefreshMulti) Hooks() []tofu.Hook

func (RefreshMulti) Operation

func (m RefreshMulti) Operation() Operation

func (RefreshMulti) Outputs

func (m RefreshMulti) Outputs(outputValues map[string]*states.OutputValue)

type Root

type Root struct {
	// contains filtered or unexported fields
}

Root is the view that is meant to be used strictly during the initialisation of the process and offers methods to print errors as raw as possible.

func NewRoot

func NewRoot(view *View) *Root

func (*Root) Diagnostics

func (v *Root) Diagnostics(diagnostics tfdiags.Diagnostics)

func (*Root) Error

func (v *Root) Error(msg string)

type Show

type Show interface {
	// DisplayState renders the given state snapshot, returning a status code for "tofu show" to return.
	DisplayState(ctx context.Context, stateFile *statefile.File, schemas *tofu.Schemas) int

	// DisplayPlan renders the given plan, returning a status code for "tofu show" to return.
	//
	// Unfortunately there are two possible ways to represent a plan:
	// - Locally-generated plans are loaded as *plans.Plan.
	// - Remotely-generated plans (using remote operations) are loaded as *cloudplan.RemotePlanJSON.
	//
	// Therefore the implementation of this method must handle both cases,
	// preferring planJSON if it is not nil and using plan otherwise.
	DisplayPlan(ctx context.Context, plan *plans.Plan, planJSON *cloudplan.RemotePlanJSON, config *configs.Config, priorStateFile *statefile.File, schemas *tofu.Schemas) int

	// DisplayConfig renders the given configuration, returning a status code for "tofu show" to return.
	DisplayConfig(config *configs.Config, schemas *tofu.Schemas) int

	// DisplaySingleModule renders just one module, in a format that's a subset
	// of that used by [Show.DisplayConfig] which we can produce without
	// schema or child module information.
	DisplaySingleModule(module *configs.Module) int

	// Diagnostics renders early diagnostics, resulting from argument parsing.
	Diagnostics(diags tfdiags.Diagnostics)
}

func NewShow

func NewShow(args arguments.ViewOptions, view *View) Show

type ShowHuman

type ShowHuman struct {
	// contains filtered or unexported fields
}

func (*ShowHuman) Diagnostics

func (v *ShowHuman) Diagnostics(diags tfdiags.Diagnostics)

func (*ShowHuman) DisplayConfig

func (v *ShowHuman) DisplayConfig(config *configs.Config, schemas *tofu.Schemas) int

func (*ShowHuman) DisplayPlan

func (v *ShowHuman) DisplayPlan(_ context.Context, plan *plans.Plan, planJSON *cloudplan.RemotePlanJSON, config *configs.Config, priorStateFile *statefile.File, schemas *tofu.Schemas) int

func (*ShowHuman) DisplaySingleModule

func (v *ShowHuman) DisplaySingleModule(_ *configs.Module) int

func (*ShowHuman) DisplayState

func (v *ShowHuman) DisplayState(_ context.Context, stateFile *statefile.File, schemas *tofu.Schemas) int

type ShowJSON

type ShowJSON struct {
	// contains filtered or unexported fields
}

func (*ShowJSON) Diagnostics

func (v *ShowJSON) Diagnostics(diags tfdiags.Diagnostics)

Diagnostics should only be called if show cannot be executed. In this case, we choose to render human-readable diagnostic output, primarily for backwards compatibility.

func (*ShowJSON) DisplayConfig

func (v *ShowJSON) DisplayConfig(config *configs.Config, schemas *tofu.Schemas) int

func (*ShowJSON) DisplayPlan

func (v *ShowJSON) DisplayPlan(_ context.Context, plan *plans.Plan, planJSON *cloudplan.RemotePlanJSON, config *configs.Config, priorStateFile *statefile.File, schemas *tofu.Schemas) int

func (*ShowJSON) DisplaySingleModule

func (v *ShowJSON) DisplaySingleModule(module *configs.Module) int

func (*ShowJSON) DisplayState

func (v *ShowJSON) DisplayState(_ context.Context, stateFile *statefile.File, schemas *tofu.Schemas) int

type ShowMulti

type ShowMulti []Show

func (ShowMulti) Diagnostics

func (m ShowMulti) Diagnostics(diags tfdiags.Diagnostics)

func (ShowMulti) DisplayConfig

func (m ShowMulti) DisplayConfig(config *configs.Config, schemas *tofu.Schemas) int

func (ShowMulti) DisplayPlan

func (m ShowMulti) DisplayPlan(ctx context.Context, plan *plans.Plan, planJSON *cloudplan.RemotePlanJSON, config *configs.Config, priorStateFile *statefile.File, schemas *tofu.Schemas) int

func (ShowMulti) DisplaySingleModule

func (m ShowMulti) DisplaySingleModule(module *configs.Module) int

func (ShowMulti) DisplayState

func (m ShowMulti) DisplayState(ctx context.Context, stateFile *statefile.File, schemas *tofu.Schemas) int

type State

type State interface {
	Diagnostics(diags tfdiags.Diagnostics)

	// General `state` output
	StateNotFound()
	StateLoadingFailure(baseError string)
	StateSavingError(baseError string)

	// `tofu state list` specific
	StateListAddr(resAddr addrs.AbsResourceInstance)

	// `tofu state mv` specific
	ErrorMovingToAlreadyExistingDst()
	ResourceMoveStatus(dryRun bool, src, dest string)
	DryRunMovedStatus(moved int)
	MoveFinalStatus(moved int)

	// `tofu state pull` specific
	PrintPulledState(state string)

	// `tofu state replace-provider` specific
	NoMatchingResourcesForProviderReplacement()
	ReplaceProviderOverview(from, to addrs.Provider, willReplace []*states.Resource)
	ReplaceProviderCancelled()
	ProviderReplaced(forResources int)

	// `tofu state rm` specific
	ResourceRemoveStatus(dryRun bool, target string)
	DryRunRemovedStatus(removed int)
	RemoveFinalStatus(count int)

	// `tofu state show` specific
	UnsupportedLocalOp()
	AddressParsingError(resAddr string)
	NoInstanceFoundError()
	ShowResourceState(ctx context.Context, stateFile *statefile.File, schemas *tofu.Schemas) int

	// Backend returns the non-command view that contains methods to provide
	// progress output for the backend operations.
	Backend() Backend
}

func NewState

func NewState(args arguments.ViewOptions, view *View) State

NewState returns an initialized State implementation for the given ViewType.

type StateHuman

type StateHuman struct {
	// contains filtered or unexported fields
}

func (*StateHuman) AddressParsingError

func (v *StateHuman) AddressParsingError(resAddr string)

func (*StateHuman) Backend

func (v *StateHuman) Backend() Backend

func (*StateHuman) Diagnostics

func (v *StateHuman) Diagnostics(diags tfdiags.Diagnostics)

func (*StateHuman) DryRunMovedStatus

func (v *StateHuman) DryRunMovedStatus(moved int)

func (*StateHuman) DryRunRemovedStatus

func (v *StateHuman) DryRunRemovedStatus(removed int)

func (*StateHuman) ErrorMovingToAlreadyExistingDst

func (v *StateHuman) ErrorMovingToAlreadyExistingDst()

func (*StateHuman) MoveFinalStatus

func (v *StateHuman) MoveFinalStatus(moved int)

func (*StateHuman) NoInstanceFoundError

func (v *StateHuman) NoInstanceFoundError()

func (*StateHuman) NoMatchingResourcesForProviderReplacement

func (v *StateHuman) NoMatchingResourcesForProviderReplacement()

func (*StateHuman) PrintPulledState

func (v *StateHuman) PrintPulledState(state string)

func (*StateHuman) ProviderReplaced

func (v *StateHuman) ProviderReplaced(forResources int)

func (*StateHuman) RemoveFinalStatus

func (v *StateHuman) RemoveFinalStatus(count int)

func (*StateHuman) ReplaceProviderCancelled

func (v *StateHuman) ReplaceProviderCancelled()

func (*StateHuman) ReplaceProviderOverview

func (v *StateHuman) ReplaceProviderOverview(from, to addrs.Provider, willReplace []*states.Resource)

func (*StateHuman) ResourceMoveStatus

func (v *StateHuman) ResourceMoveStatus(dryRun bool, src, dest string)

func (*StateHuman) ResourceRemoveStatus

func (v *StateHuman) ResourceRemoveStatus(dryRun bool, target string)

func (*StateHuman) ShowResourceState

func (v *StateHuman) ShowResourceState(_ context.Context, stateFile *statefile.File, schemas *tofu.Schemas) int

func (*StateHuman) StateListAddr

func (v *StateHuman) StateListAddr(resAddr addrs.AbsResourceInstance)

func (*StateHuman) StateLoadingFailure

func (v *StateHuman) StateLoadingFailure(baseError string)

func (*StateHuman) StateNotFound

func (v *StateHuman) StateNotFound()

func (*StateHuman) StateSavingError

func (v *StateHuman) StateSavingError(baseError string)

func (*StateHuman) UnsupportedLocalOp

func (v *StateHuman) UnsupportedLocalOp()

type StateJSON

type StateJSON struct {
	// contains filtered or unexported fields
}

func (*StateJSON) AddressParsingError

func (v *StateJSON) AddressParsingError(resAddr string)

func (*StateJSON) Backend

func (v *StateJSON) Backend() Backend

func (*StateJSON) Diagnostics

func (v *StateJSON) Diagnostics(diags tfdiags.Diagnostics)

func (*StateJSON) DryRunMovedStatus

func (v *StateJSON) DryRunMovedStatus(moved int)

func (*StateJSON) DryRunRemovedStatus

func (v *StateJSON) DryRunRemovedStatus(removed int)

func (*StateJSON) ErrorMovingToAlreadyExistingDst

func (v *StateJSON) ErrorMovingToAlreadyExistingDst()

func (*StateJSON) MoveFinalStatus

func (v *StateJSON) MoveFinalStatus(moved int)

func (*StateJSON) NoInstanceFoundError

func (v *StateJSON) NoInstanceFoundError()

func (*StateJSON) NoMatchingResourcesForProviderReplacement

func (v *StateJSON) NoMatchingResourcesForProviderReplacement()

func (*StateJSON) PrintPulledState

func (v *StateJSON) PrintPulledState(_ string)

func (*StateJSON) ProviderReplaced

func (v *StateJSON) ProviderReplaced(forResources int)

func (*StateJSON) RemoveFinalStatus

func (v *StateJSON) RemoveFinalStatus(count int)

func (*StateJSON) ReplaceProviderCancelled

func (v *StateJSON) ReplaceProviderCancelled()

func (*StateJSON) ReplaceProviderOverview

func (v *StateJSON) ReplaceProviderOverview(from, to addrs.Provider, willReplace []*states.Resource)

func (*StateJSON) ResourceMoveStatus

func (v *StateJSON) ResourceMoveStatus(dryRun bool, src, dest string)

func (*StateJSON) ResourceRemoveStatus

func (v *StateJSON) ResourceRemoveStatus(dryRun bool, target string)

func (*StateJSON) ShowResourceState

func (v *StateJSON) ShowResourceState(_ context.Context, stateFile *statefile.File, schemas *tofu.Schemas) int

func (*StateJSON) StateListAddr

func (v *StateJSON) StateListAddr(resAddr addrs.AbsResourceInstance)

func (*StateJSON) StateLoadingFailure

func (v *StateJSON) StateLoadingFailure(baseError string)

func (*StateJSON) StateNotFound

func (v *StateJSON) StateNotFound()

func (*StateJSON) StateSavingError

func (v *StateJSON) StateSavingError(baseError string)

func (*StateJSON) UnsupportedLocalOp

func (v *StateJSON) UnsupportedLocalOp()

type StateLocker

type StateLocker interface {
	Locking()
	Unlocking()
}

The StateLocker view is used to display locking/unlocking status messages if the state lock process takes longer than expected.

type StateLockerHuman

type StateLockerHuman struct {
	// contains filtered or unexported fields
}

StateLockerHuman is an implementation of StateLocker which prints status to a terminal.

func (*StateLockerHuman) Locking

func (v *StateLockerHuman) Locking()

func (*StateLockerHuman) Unlocking

func (v *StateLockerHuman) Unlocking()

type StateLockerJSON

type StateLockerJSON struct {
	// contains filtered or unexported fields
}

StateLockerJSON is an implementation of StateLocker which prints the state lock status to a terminal in machine-readable JSON form.

func (*StateLockerJSON) Locking

func (v *StateLockerJSON) Locking()

func (*StateLockerJSON) Unlocking

func (v *StateLockerJSON) Unlocking()

type StateLockerMulti

type StateLockerMulti []StateLocker

func (StateLockerMulti) Locking

func (m StateLockerMulti) Locking()

func (StateLockerMulti) Unlocking

func (m StateLockerMulti) Unlocking()

type StateMulti

type StateMulti []State

func (StateMulti) AddressParsingError

func (m StateMulti) AddressParsingError(resAddr string)

func (StateMulti) Backend

func (m StateMulti) Backend() Backend

func (StateMulti) Diagnostics

func (m StateMulti) Diagnostics(diags tfdiags.Diagnostics)

func (StateMulti) DryRunMovedStatus

func (m StateMulti) DryRunMovedStatus(moved int)

func (StateMulti) DryRunRemovedStatus

func (m StateMulti) DryRunRemovedStatus(removed int)

func (StateMulti) ErrorMovingToAlreadyExistingDst

func (m StateMulti) ErrorMovingToAlreadyExistingDst()

func (StateMulti) MoveFinalStatus

func (m StateMulti) MoveFinalStatus(moved int)

func (StateMulti) NoInstanceFoundError

func (m StateMulti) NoInstanceFoundError()

func (StateMulti) NoMatchingResourcesForProviderReplacement

func (m StateMulti) NoMatchingResourcesForProviderReplacement()

func (StateMulti) PrintPulledState

func (m StateMulti) PrintPulledState(state string)

func (StateMulti) ProviderReplaced

func (m StateMulti) ProviderReplaced(forResources int)

func (StateMulti) RemoveFinalStatus

func (m StateMulti) RemoveFinalStatus(count int)

func (StateMulti) ReplaceProviderCancelled

func (m StateMulti) ReplaceProviderCancelled()

func (StateMulti) ReplaceProviderOverview

func (m StateMulti) ReplaceProviderOverview(from, to addrs.Provider, willReplace []*states.Resource)

func (StateMulti) ResourceMoveStatus

func (m StateMulti) ResourceMoveStatus(dryRun bool, src, dest string)

func (StateMulti) ResourceRemoveStatus

func (m StateMulti) ResourceRemoveStatus(dryRun bool, target string)

func (StateMulti) ShowResourceState

func (m StateMulti) ShowResourceState(ctx context.Context, stateFile *statefile.File, schemas *tofu.Schemas) int

func (StateMulti) StateListAddr

func (m StateMulti) StateListAddr(resAddr addrs.AbsResourceInstance)

func (StateMulti) StateLoadingFailure

func (m StateMulti) StateLoadingFailure(baseError string)

func (StateMulti) StateNotFound

func (m StateMulti) StateNotFound()

func (StateMulti) StateSavingError

func (m StateMulti) StateSavingError(baseError string)

func (StateMulti) UnsupportedLocalOp

func (m StateMulti) UnsupportedLocalOp()

type StatelessBindCandidate

type StatelessBindCandidate struct {
	Addr        string
	TypeName    string
	LiveID      string
	DisplayName string
	Tags        []StatelessTag

	// Matched are the identity-bearing arguments the live resource and the
	// declared instance agreed on exactly.
	Matched []StatelessTag

	// MarkerEstate and MarkerAddress are the tofu-estate and tofu-address
	// values that would adopt the resource.
	MarkerEstate  string
	MarkerAddress string

	// Hint is a one-line command that writes those two tags, empty for a
	// type stateless mode has no command for.
	Hint string
}

StatelessBindCandidate is one live resource offered for adoption.

type StatelessEstateCount

type StatelessEstateCount struct {
	Estate string
	Count  int
	Types  []string
}

StatelessEstateCount is how many live resources another estate owns.

type StatelessForeign

type StatelessForeign struct {
	// Estate is the estate the classification was drawn around.
	Estate string

	// Items are the foreign resources: report only, never deletion
	// candidates.
	Items []StatelessForeignItem

	// Candidates are the adoptable ones, each naming the declared address it
	// matches and the command that would claim it.
	Candidates []StatelessBindCandidate

	// Removals are the live resources this estate owns at addresses the
	// configuration no longer declares, which the plan below proposes
	// destroying. Unlike everything else in this report they are not
	// report-only: each one is in the prior state the plan ran against.
	Removals []StatelessRemoval

	// SweepGaps are the resource types the removal sweep could not
	// enumerate, and SweepCovered the ones it did. An empty Removals list
	// means "nothing undeclared was found among SweepCovered" and nothing
	// more.
	SweepGaps    []StatelessSweepGap
	SweepCovered []string

	// Renames are the live resources this estate owns whose marker names a
	// for_each key the configuration no longer declares, paired with the
	// declared instance they are probably the same resource as.
	Renames []StatelessRename

	// AmbiguousRenames are the resource blocks where such a pairing exists
	// but is not one-to-one, so no rename is offered.
	AmbiguousRenames []StatelessRenameAmbiguity

	// OtherEstates are the per-estate counts. An empty Estate means the
	// resources were counted without their estate being recorded.
	OtherEstates []StatelessEstateCount

	// Swept are the resource types that were listed in full.
	Swept []string

	// Unswept are the types this classification cannot speak for, with a
	// reason code and a sentence each.
	Unswept []StatelessUnsweptType

	// ParentReads are the untaggable children a parent read found (issue
	// #60): resources with no marker and no declared block of their own,
	// found by reading a marked, admitted parent's identity instead. Each
	// says whether it also became a removal - the plan's own resource diff
	// carries the destroy itself for those, and this list is what says a
	// parent read is why.
	ParentReads []StatelessParentRead
}

StatelessForeign is the foreign classification of one discovery pass, in a form this package can render without importing the classifier.

The fields correspond to foreign.Result: the live resources nobody claims, the ones that exactly match a declared instance and are offered for adoption, the counts belonging to other estates, and - the part that must never be dropped for being boring - which resource types the sweep can speak for at all.

type StatelessForeignItem

type StatelessForeignItem struct {
	TypeName    string
	LiveID      string
	DisplayName string
	Tags        []StatelessTag
	Why         string
}

StatelessForeignItem is one live resource nobody claims.

type StatelessImport added in v0.3.0

type StatelessImport interface {
	Ratification(rep StatelessImportReport)
	Stamped(rep StatelessImportStamped)
}

StatelessImport renders what "choudoufu live-import" produces: the ratification report first, always, and the stamp report only on a run given -approve. Diagnostics do not come through here: they go to View and out to stderr, the way every other command's do.

func NewStatelessImport added in v0.3.0

func NewStatelessImport(view *View) StatelessImport

NewStatelessImport returns the human-readable implementation. There is no JSON implementation, matching live-mv.

type StatelessImportEntry added in v0.3.0

type StatelessImportEntry struct {
	Addr     string
	TypeName string
	Status   string
	Detail   string
	LiveID   string
	Drifted  []string
}

StatelessImportEntry is one resource instance's ratification verdict, in a form this package can render without importing the liveimport package. The fields correspond to liveimport.Entry.

type StatelessImportHuman added in v0.3.0

type StatelessImportHuman struct {
	// contains filtered or unexported fields
}

StatelessImportHuman writes both reports to the view's output stream.

func (*StatelessImportHuman) Ratification added in v0.3.0

func (v *StatelessImportHuman) Ratification(rep StatelessImportReport)

func (*StatelessImportHuman) Stamped added in v0.3.0

type StatelessImportOutcome added in v0.3.0

type StatelessImportOutcome struct {
	Addr     string
	TypeName string
	Outcome  string
	Detail   string
}

StatelessImportOutcome is one resource instance's stamp outcome, in a form this package can render without importing the liveimport package. The fields correspond to liveimport.StampOutcome.

type StatelessImportReport added in v0.3.0

type StatelessImportReport struct {
	Estate    string
	StatePath string
	Entries   []StatelessImportEntry
}

StatelessImportReport is the whole ratification report "choudoufu live-import" prints before any tag is written.

type StatelessImportStamped added in v0.3.0

type StatelessImportStamped struct {
	Estate   string
	Outcomes []StatelessImportOutcome

	// IdentitiesRecorded is [liveimport.StampReport.IdentitiesRecorded]:
	// GitHub issue #364 unit A2's count of instances that now carry a
	// kind=identity record, across every carrier that can hold one -
	// stamped, untaggable, and markers=record selected - and never a
	// record-backed instance's own kind=object value. Rendered as its own
	// sentence rather than folded into the outcome line below, so every
	// crossing script's existing grep against that exact line keeps
	// matching byte for byte.
	IdentitiesRecorded int
}

StatelessImportStamped is what one -approve run did.

type StatelessLookalike added in v0.3.0

type StatelessLookalike struct {
	// Addr is the declared instance the plan proposes to create - the same
	// address the resource diff's own "will be created" line names.
	Addr     string
	TypeName string

	// LiveID is the unowned live resource's identity, empty when the
	// provider sent no usable one.
	LiveID      string
	DisplayName string

	// Matched are the identity-bearing arguments that confirmed the match,
	// empty for the generic, cardinality-only warning.
	Matched []StatelessTag

	// MarkerEstate and MarkerAddress are the tofu-estate and tofu-address
	// values that adopt the live resource instead of creating a duplicate.
	MarkerEstate  string
	MarkerAddress string

	// Hint is the one-line adoption command, empty for a type this fork has
	// no composable tagging verb for.
	Hint string
}

StatelessLookalike is one lookalike guard warning: a declared instance the plan actually proposes to create, beside a live resource this estate does not own that might be the very thing being duplicated. The fields correspond to [foreign.Lookalike].

type StatelessMv

type StatelessMv interface {
	Report(rep StatelessMvReport)
}

StatelessMv renders the report "choudoufu live-mv" prints when a rename succeeds. Diagnostics do not come through here: they go to View and out to stderr, the way every other command's do.

func NewStatelessMv

func NewStatelessMv(view *View) StatelessMv

NewStatelessMv returns the human-readable implementation. There is no JSON implementation, and live-mv accepts no -json flag to ask for one.

type StatelessMvHuman

type StatelessMvHuman struct {
	// contains filtered or unexported fields
}

StatelessMvHuman writes the report to the view's output stream, which is what makes live-mv's output land where every other command's does - and what makes it testable through terminal.StreamsForTesting rather than through an io.Writer bolted onto the command struct.

func (*StatelessMvHuman) Report

func (v *StatelessMvHuman) Report(rep StatelessMvReport)

type StatelessMvReport

type StatelessMvReport struct {
	// Estate is the estate the rename happened within.
	Estate string

	// TypeName, LiveID and DisplayName identify the live resource that was
	// written to. DisplayName is empty for a type with no name to show.
	TypeName    string
	LiveID      string
	DisplayName string

	// OldAddr and NewAddr are the two addresses as the operator typed them,
	// and OldMarker and NewMarker are what the tofu-address tag held before
	// and after.
	OldAddr   string
	NewAddr   string
	OldMarker string
	NewMarker string

	// FoundBy names the path that located the resource - listing the type
	// and reading markers, or reading the identity the configuration names.
	FoundBy string

	// DryRun means nothing was written.
	DryRun bool
}

StatelessMvReport is one completed (or, with DryRun, one rehearsed) rename, in a form this package can render without importing the mv package.

The fields correspond to mv.Result. They are all strings on purpose: what a rename produces is a set of labelled facts about one live resource, and the operator needs to be able to read and to grep them, not to be told a story about them.

type StatelessOmission

type StatelessOmission struct {
	Addr   string
	Reason string
	Detail string
}

StatelessOmission is one resource instance that the stateless projection could not read from the live system, in a form this package can render without importing the projection builder.

The three fields correspond to projection.Omission's Addr, Reason and Detail: the address that was not read, a stable machine-readable reason code, and a sentence for an operator.

type StatelessParentRead added in v0.3.0

type StatelessParentRead struct {
	TypeName    string
	Parent      string
	ParentAddr  string
	ParentValue string
	LiveID      string
	DisplayName string

	// Removal is true when this finding also entered the prior state as a
	// destroy.
	Removal bool

	// Withheld is why Removal is false, empty when Removal is true.
	Withheld string
}

StatelessParentRead is one live child a parent read found.

type StatelessPlan

type StatelessPlan interface {
	// Progress reports one discovery heartbeat. It is the only method on
	// this interface that writes to stderr rather than stdout: a heartbeat
	// exists to prove a slow, silent sweep is still running, not to become
	// part of the plan's own output, and it must never appear in anything a
	// script reads from this command's stdout. The caller decides how often
	// to call it; every call here is rendered.
	Progress(p StatelessProgress)

	// Omissions reports the instances that are missing from the projection,
	// which is why the plan that follows proposes to create them.
	Omissions(oms []StatelessOmission)

	// Unowned reports the live resources found at declared identities
	// without this estate's marker: which of them a tag write adopts, and
	// which are simply in the way of the create the plan proposes.
	Unowned(items []StatelessUnowned)

	// Foreign reports the live resources the estate does not own: what was
	// found, what could be adopted, and which types the sweep covered.
	Foreign(rep StatelessForeign)

	// Policy reports what GitHub issue #67's policy block did this run:
	// which declared instances a non-default verb governed, which
	// undeclared_tagged resources a non-default verb withheld from the
	// sweep, which resources released a tag key, and the scoped
	// account-reconciliation roster when undeclared_untagged = "delete"
	// ran. A no-op when rep.Empty().
	Policy(rep StatelessPolicyReport)

	// GuidedFallback reports why a pass that had guided discovery
	// configured (issue #64) fell back to today's full sweep instead of
	// using it - a stale, missing or unreadable hint in the estate's
	// record store, in one sentence from
	// [discovery.Result.GuidedFallback]. reason is empty whenever guided
	// discovery was never configured for this pass, or whenever it engaged
	// successfully, and an empty reason renders nothing: this is
	// informational only, never a warning that something is wrong with the
	// plan itself, which the fallback's own safety argument (a stale or
	// missing hint costs one full re-read, never a wrong plan) is what
	// makes true.
	GuidedFallback(reason string)

	// Lookalikes reports the lookalike guard's findings: planned creates
	// that might duplicate a live resource this estate does not own, each
	// naming the resource and the adoption remedy. Printed last, immediately
	// above the plan itself, so the warning sits right next to the create it
	// is about.
	Lookalikes(items []StatelessLookalike)
}

StatelessPlan renders the parts of live-plan's output that have no equivalent in a stock plan. The plan itself is rendered by the ordinary Plan view, so that live-plan and plan produce identical output for the part they have in common.

func NewStatelessPlan

func NewStatelessPlan(view *View) StatelessPlan

NewStatelessPlan returns the human-readable implementation. There is no JSON implementation yet, and the live-plan command rejects -json rather than emitting output that omits this section.

type StatelessPlanHuman

type StatelessPlanHuman struct {
	// contains filtered or unexported fields
}

StatelessPlanHuman writes the omissions section as a titled block above the plan, in the same stream and with the same width and colouring rules as the plan renderer itself.

func (*StatelessPlanHuman) Foreign

func (v *StatelessPlanHuman) Foreign(rep StatelessForeign)

Foreign renders the classification of the live resources this estate does not own, below the omissions and above the plan.

The section is printed whenever discovery ran, including when it found nothing: "swept and found none" and "nothing was swept" are different answers, and only saying something when resources turn up would make them indistinguishable.

func (*StatelessPlanHuman) GuidedFallback added in v0.3.0

func (v *StatelessPlanHuman) GuidedFallback(reason string)

GuidedFallback renders the one-sentence reason a configured guided-discovery pass fell back to a full sweep, as a small informational note rather than a titled, itemized section like the ones around it: there is exactly one sentence to say, about the run as a whole rather than about any particular resource, so a heading-plus-intro-plus-list shape would be a lot of scaffolding around one line.

func (*StatelessPlanHuman) Lookalikes added in v0.3.0

func (v *StatelessPlanHuman) Lookalikes(items []StatelessLookalike)

Lookalikes renders the lookalike guard's findings, last of the live-plan-only sections and immediately above the plan diff itself, so that a warning about a create sits as close as this report gets to the create it is about.

Printed only when there is something to say: unlike Foreign, this section is not a sweep-coverage question with its own thing to report when empty - a plan with nothing to warn about is simply a plan with nothing to warn about.

func (*StatelessPlanHuman) Omissions

func (v *StatelessPlanHuman) Omissions(oms []StatelessOmission)

func (*StatelessPlanHuman) Policy added in v0.3.0

Policy renders GitHub issue #67's policy report as its own section, between Foreign and the plan. A no-op when rep.Empty(), so a run with no policy block - or one that only ever names default verbs - prints nothing new at all.

func (*StatelessPlanHuman) Progress added in v0.3.0

func (v *StatelessPlanHuman) Progress(p StatelessProgress)

Progress writes one heartbeat line to stderr, dark-grey like the horizontal rules elsewhere in this package (see format.HorizontalRule) so it reads as ambient status rather than as a result. It is deliberately plain: no section header, no word wrap, one line that a scrolling terminal simply carries away - the throttling that keeps this from becoming a log is the caller's job, not this method's.

The wording says "so far" and names the type still being scanned rather than reading as a finished tally (issue #229): the caller's throttle (statelessProgress) always lets the very first event through unconditionally, and a fast run - a small emulator estate finishes well under the 500ms throttle window - can end up printing only that one event. Before this fix that line was "discovering: 1 type scanned, 1 live resource found (aws_acm_certificate)", which reads exactly like a final count and sent a #229 investigation down the wrong path chasing why discovery only looked at one type, when in fact hundreds more had been scanned by the time the plan finished - this is the running count as of one type partway through, not the total.

func (*StatelessPlanHuman) Unowned

func (v *StatelessPlanHuman) Unowned(items []StatelessUnowned)

Unowned renders the projection's refusals as their own section, between the omissions and the foreign report, so that "this needs adopting" and "something else is in the way of this address" read at a glance instead of out of the omission prose. Nothing renders when there is nothing to say: unlike the sweep behind the foreign section, this check runs on every instance the projection reads, so an empty list is not a coverage question.

type StatelessPolicyDeclared added in v0.3.0

type StatelessPolicyDeclared struct {
	Addr     string
	TypeName string

	// Tagged says which declared quadrant: declared_tagged when true,
	// declared_untagged when false.
	Tagged bool

	Verb string
}

StatelessPolicyDeclared is one declared instance whose admission or tag handling GitHub issue #67's policy governed with a non-default verb - projection.PolicyOutcome, in a form this package can render without importing the projection builder.

type StatelessPolicyReport added in v0.3.0

type StatelessPolicyReport struct {
	Declared  []StatelessPolicyDeclared
	Withheld  []StatelessPolicyWithheld
	Untagged  []StatelessUntagged
	Released  []StatelessReleased
	Reconcile StatelessReconcile
}

StatelessPolicyReport is everything GitHub issue #67's policy block did this run beyond today's fixed behavior. Every field is empty on a run with no policy block, or one that only ever names default verbs - which is what makes "omitted policy = byte-identical current behavior" visible in the rendered output and not only in the underlying data.

func (StatelessPolicyReport) Empty added in v0.3.0

func (r StatelessPolicyReport) Empty() bool

Empty reports whether there is nothing to render.

type StatelessPolicyWithheld added in v0.3.0

type StatelessPolicyWithheld struct {
	TypeName    string
	LiveID      string
	DisplayName string
	Marker      string
	Verb        string
	Withheld    string
}

StatelessPolicyWithheld is one owned-but-undeclared resource (undeclared_tagged) a non-default policy verb kept out of the removal sweep - discovery.OwnedResource with a PolicyVerb set, mirrored into StatelessRemoval's shape plus the verb and the withheld sentence.

type StatelessProgress added in v0.3.0

type StatelessProgress struct {
	TypeName       string
	TypesScanned   int
	ResourcesFound int
}

StatelessProgress is one discovery heartbeat, already throttled by the caller: how many resource types have been scanned in total and how many live resources scanning has found, as of the type named in TypeName. It mirrors [discovery.ProgressEvent] rather than importing that package, the same way every other type in this file carries the projection and foreign packages' data across without importing them - see this file's other Stateless* types.

type StatelessReconcile added in v0.3.0

type StatelessReconcile struct {
	Ran               bool
	Roster            []StatelessReconcileCandidate
	Gaps              []StatelessReconcileGap
	Threshold         int
	ThresholdExceeded bool
}

StatelessReconcile is the outcome of one scoped account-reconciliation pass, when the resolved policy asked for one.

type StatelessReconcileCandidate added in v0.3.0

type StatelessReconcileCandidate struct {
	TypeName    string
	LiveID      string
	DisplayName string
}

StatelessReconcileCandidate is one live resource GitHub issue #67's undeclared_untagged = "delete" scoped account reconciliation would destroy - discovery.ReconcileCandidate, rendered with identity evidence per the issue's "no aggregate count without the roster" rule.

type StatelessReconcileGap added in v0.3.0

type StatelessReconcileGap struct {
	TypeName string
	Reason   string
	Detail   string
}

StatelessReconcileGap is one scope-selected type the reconciliation pass could not enumerate.

type StatelessReleased added in v0.3.0

type StatelessReleased struct {
	TypeName     string
	LiveID       string
	DisplayName  string
	Marker       string
	Key          string
	EstateMarker bool
	OK           bool
	Detail       string
}

StatelessReleased is one owned-but-undeclared resource GitHub issue #67's undeclared_tagged = "untag" verb released a tag key from for real, during apply - internal/live/untag.Outcome, in this package's own shape.

Distinct from StatelessUntagged: that type reports a declared_tagged block's tag removal from the plan that proposes it, since the ordinary apply graph performs the write and a plan showing it is a true prediction. This resource has no configuration block and no graph node, so there is nothing to predict - only [statelessRunner.AfterApply]'s own report, after a real apply, of what actually happened. OK false means the resource was left exactly as it was found; nothing here ever falls back to destroying it.

type StatelessRemoval

type StatelessRemoval struct {
	// Addr is where it sits in the prior state, which is the address the
	// plan's own destroy line names.
	Addr string

	TypeName    string
	LiveID      string
	DisplayName string

	// Marker is the tofu-address value it carries, escaped as stored.
	Marker string

	// BlockGone distinguishes a deleted resource block from a block that no
	// longer expands to this instance key.
	BlockGone bool

	// Swept is true when the estate-wide sweep found it, which is the case a
	// config-driven scan cannot see at all.
	Swept bool

	// Why is one sentence saying what makes it a removal.
	Why string
}

StatelessRemoval is one live resource this estate owns and no longer declares, which the plan proposes destroying.

type StatelessRename

type StatelessRename struct {
	// OldAddr is the address the live marker claims and NewAddr the declared
	// instance nothing claimed, both unescaped.
	OldAddr string
	NewAddr string

	TypeName    string
	LiveID      string
	DisplayName string

	// Command is the exact live-mv invocation, quoted for a shell.
	Command string
}

StatelessRename is one live resource that may have moved to a new for_each key, with the command that would move its marker.

type StatelessRenameAmbiguity

type StatelessRenameAmbiguity struct {
	Block string

	// Live are the orphaned live resources, as "marker (live ID)".
	Live []string

	// Declared are the addresses nothing claimed.
	Declared []string

	// Detail is one sentence saying what the obstacle is.
	Detail string
}

StatelessRenameAmbiguity is one resource block whose orphans and unclaimed declared instances do not pair one-to-one.

type StatelessSweepGap

type StatelessSweepGap struct {
	TypeName string
	Reason   string
	Detail   string
}

StatelessSweepGap is one resource type the removal sweep could not cover.

type StatelessTag

type StatelessTag struct {
	Key   string
	Value string
}

StatelessTag is one key/value pair: a resource tag, or an argument a content match was made on.

type StatelessUnowned

type StatelessUnowned struct {
	// Addr is the declared instance whose identity found it.
	Addr string

	// TypeName is the resource type and LiveID the identity the live
	// resource was read with, which is the handle a human needs to go look
	// at it.
	TypeName string
	LiveID   string

	// HeldBy is the tofu-estate marker the live resource carries, empty when
	// it carries none. A non-empty value means the resource is owned, just
	// not by this run.
	HeldBy string

	// MarkerEstate and MarkerAddress are the tofu-estate and tofu-address
	// values that would adopt the resource, both empty when adoption is not
	// this run's to offer: the resource belongs to another estate, or this
	// run has no estate name to write.
	MarkerEstate  string
	MarkerAddress string
}

StatelessUnowned is one live resource the projection refused to admit: it sits at the identity a declared resource names and carries no ownership marker for this estate. The fields correspond to projection.Unowned, plus the two tag values that would adopt it, worked out by the caller.

type StatelessUnsweptType

type StatelessUnsweptType struct {
	TypeName string
	Reason   string
	Detail   string
}

StatelessUnsweptType is one resource type whose live population is unknown.

type StatelessUntagged added in v0.3.0

type StatelessUntagged struct {
	Addr         string
	Key          string
	EstateMarker bool
}

StatelessUntagged is one resource block a declared_tagged = "untag" verb released a tag key from - stamp.Untagged, in this package's own shape.

type Taint

type Taint interface {
	Diagnostics(diags tfdiags.Diagnostics)
	TaintedSuccessfully(addr addrs.AbsResourceInstance)
	UntaintedSuccessfully(addr addrs.AbsResourceInstance)

	// Backend returns the non-command view that contains methods to provide
	// progress output for the backend operations.
	Backend() Backend
}

func NewTaint

func NewTaint(args arguments.ViewOptions, view *View) Taint

NewTaint returns an initialized Taint implementation for the given ViewType.

type TaintHuman

type TaintHuman struct {
	// contains filtered or unexported fields
}

func (*TaintHuman) Backend

func (v *TaintHuman) Backend() Backend

func (*TaintHuman) Diagnostics

func (v *TaintHuman) Diagnostics(diags tfdiags.Diagnostics)

func (*TaintHuman) TaintedSuccessfully

func (v *TaintHuman) TaintedSuccessfully(addr addrs.AbsResourceInstance)

func (*TaintHuman) UntaintedSuccessfully

func (v *TaintHuman) UntaintedSuccessfully(addr addrs.AbsResourceInstance)

type TaintJSON

type TaintJSON struct {
	// contains filtered or unexported fields
}

func (*TaintJSON) Backend

func (v *TaintJSON) Backend() Backend

func (*TaintJSON) Diagnostics

func (v *TaintJSON) Diagnostics(diags tfdiags.Diagnostics)

func (*TaintJSON) TaintedSuccessfully

func (v *TaintJSON) TaintedSuccessfully(addr addrs.AbsResourceInstance)

func (*TaintJSON) UntaintedSuccessfully

func (v *TaintJSON) UntaintedSuccessfully(addr addrs.AbsResourceInstance)

type TaintMulti

type TaintMulti []Taint

func (TaintMulti) Backend

func (m TaintMulti) Backend() Backend

func (TaintMulti) Diagnostics

func (m TaintMulti) Diagnostics(diags tfdiags.Diagnostics)

func (TaintMulti) TaintedSuccessfully

func (m TaintMulti) TaintedSuccessfully(addr addrs.AbsResourceInstance)

func (TaintMulti) UntaintedSuccessfully

func (m TaintMulti) UntaintedSuccessfully(addr addrs.AbsResourceInstance)

type Test

type Test interface {
	// Abstract should print an early summary of the tests that will be
	// executed. This will be called before the tests have been executed so
	// the status for everything within suite will be test.Pending.
	//
	// This should be used to state what is going to be tested.
	Abstract(suite *moduletest.Suite)

	// Conclusion should print out a summary of the tests including their
	// completed status.
	Conclusion(suite *moduletest.Suite)

	// File prints out the summary for an entire test file.
	File(file *moduletest.File)

	// Run prints out the summary for a single test run block.
	Run(run *moduletest.Run, file *moduletest.File)

	// DestroySummary prints out the summary of the destroy step of each test
	// file. If everything goes well, this should be empty.
	DestroySummary(diags tfdiags.Diagnostics, run *moduletest.Run, file *moduletest.File, state *states.State)

	// Diagnostics prints out the provided diagnostics.
	Diagnostics(run *moduletest.Run, file *moduletest.File, diags tfdiags.Diagnostics)

	// Interrupted prints out a message stating that an interrupt has been
	// received and testing will stop.
	Interrupted()

	// FatalInterrupt prints out a message stating that a hard interrupt has
	// been received and testing will stop and cleanup will be skipped.
	FatalInterrupt()

	// FatalInterruptSummary prints out the resources that were held in state
	// and were being created at the time the FatalInterrupt was received.
	//
	// This will typically be called in place of DestroySummary, as there is no
	// guarantee that this function will be called during a FatalInterrupt. In
	// addition, this function prints additional details about the current
	// operation alongside the current state as the state will be missing newly
	// created resources that also need to be handled manually.
	FatalInterruptSummary(run *moduletest.Run, file *moduletest.File, states map[*moduletest.Run]*states.State, created []*plans.ResourceInstanceChangeSrc)
}

Test renders outputs for test executions.

func NewTest

func NewTest(args arguments.ViewOptions, view *View) Test

type TestHuman

type TestHuman struct {
	// contains filtered or unexported fields
}

func (*TestHuman) Abstract

func (t *TestHuman) Abstract(_ *moduletest.Suite)

func (*TestHuman) Conclusion

func (t *TestHuman) Conclusion(suite *moduletest.Suite)

func (*TestHuman) DestroySummary

func (t *TestHuman) DestroySummary(diags tfdiags.Diagnostics, run *moduletest.Run, file *moduletest.File, state *states.State)

func (*TestHuman) Diagnostics

func (t *TestHuman) Diagnostics(_ *moduletest.Run, _ *moduletest.File, diags tfdiags.Diagnostics)

func (*TestHuman) FatalInterrupt

func (t *TestHuman) FatalInterrupt()

func (*TestHuman) FatalInterruptSummary

func (t *TestHuman) FatalInterruptSummary(run *moduletest.Run, file *moduletest.File, existingStates map[*moduletest.Run]*states.State, created []*plans.ResourceInstanceChangeSrc)

func (*TestHuman) File

func (t *TestHuman) File(file *moduletest.File)

func (*TestHuman) Interrupted

func (t *TestHuman) Interrupted()

func (*TestHuman) Run

func (t *TestHuman) Run(run *moduletest.Run, file *moduletest.File)

type TestJSON

type TestJSON struct {
	// contains filtered or unexported fields
}

func (*TestJSON) Abstract

func (t *TestJSON) Abstract(suite *moduletest.Suite)

func (*TestJSON) Conclusion

func (t *TestJSON) Conclusion(suite *moduletest.Suite)

func (*TestJSON) DestroySummary

func (t *TestJSON) DestroySummary(diags tfdiags.Diagnostics, run *moduletest.Run, file *moduletest.File, state *states.State)

func (*TestJSON) Diagnostics

func (t *TestJSON) Diagnostics(run *moduletest.Run, file *moduletest.File, diags tfdiags.Diagnostics)

func (*TestJSON) FatalInterrupt

func (t *TestJSON) FatalInterrupt()

func (*TestJSON) FatalInterruptSummary

func (t *TestJSON) FatalInterruptSummary(run *moduletest.Run, file *moduletest.File, existingStates map[*moduletest.Run]*states.State, created []*plans.ResourceInstanceChangeSrc)

func (*TestJSON) File

func (t *TestJSON) File(file *moduletest.File)

func (*TestJSON) Interrupted

func (t *TestJSON) Interrupted()

func (*TestJSON) Run

func (t *TestJSON) Run(run *moduletest.Run, file *moduletest.File)

type TestMulti

type TestMulti []Test

func (TestMulti) Abstract

func (m TestMulti) Abstract(suite *moduletest.Suite)

func (TestMulti) Conclusion

func (m TestMulti) Conclusion(suite *moduletest.Suite)

func (TestMulti) DestroySummary

func (m TestMulti) DestroySummary(diags tfdiags.Diagnostics, run *moduletest.Run, file *moduletest.File, state *states.State)

func (TestMulti) Diagnostics

func (m TestMulti) Diagnostics(run *moduletest.Run, file *moduletest.File, diags tfdiags.Diagnostics)

func (TestMulti) FatalInterrupt

func (m TestMulti) FatalInterrupt()

func (TestMulti) FatalInterruptSummary

func (m TestMulti) FatalInterruptSummary(run *moduletest.Run, file *moduletest.File, states map[*moduletest.Run]*states.State, created []*plans.ResourceInstanceChangeSrc)

func (TestMulti) File

func (m TestMulti) File(file *moduletest.File)

func (TestMulti) Interrupted

func (m TestMulti) Interrupted()

func (TestMulti) Run

func (m TestMulti) Run(run *moduletest.Run, file *moduletest.File)

type UiHook

type UiHook struct {
	tofu.NilHook
	// contains filtered or unexported fields
}

func NewUiHook

func NewUiHook(view *View) *UiHook

func (*UiHook) Deferred

func (h *UiHook) Deferred(addr addrs.AbsResourceInstance, reason string) (tofu.HookAction, error)

func (*UiHook) PostApply

func (h *UiHook) PostApply(addr addrs.AbsResourceInstance, gen states.Generation, newState cty.Value, applyerr error) (tofu.HookAction, error)

func (*UiHook) PostApplyImport

func (h *UiHook) PostApplyImport(addr addrs.AbsResourceInstance, importing plans.ImportingSrc) (tofu.HookAction, error)

func (*UiHook) PostClose

func (h *UiHook) PostClose(addr addrs.AbsResourceInstance, _ error) (tofu.HookAction, error)

func (*UiHook) PostImportState

func (h *UiHook) PostImportState(addr addrs.AbsResourceInstance, imported []providers.ImportedResource) (tofu.HookAction, error)

func (*UiHook) PostOpen

func (h *UiHook) PostOpen(addr addrs.AbsResourceInstance, _ error) (tofu.HookAction, error)

func (*UiHook) PostRenew

func (h *UiHook) PostRenew(addr addrs.AbsResourceInstance, _ error) (tofu.HookAction, error)

func (*UiHook) PreApply

func (h *UiHook) PreApply(addr addrs.AbsResourceInstance, gen states.Generation, action plans.Action, priorState, plannedNewState cty.Value) (tofu.HookAction, error)

func (*UiHook) PreApplyImport

func (h *UiHook) PreApplyImport(addr addrs.AbsResourceInstance, importing plans.ImportingSrc) (tofu.HookAction, error)

func (*UiHook) PreClose

func (h *UiHook) PreClose(addr addrs.AbsResourceInstance) (tofu.HookAction, error)

func (*UiHook) PreImportState

func (h *UiHook) PreImportState(addr addrs.AbsResourceInstance, importID string) (tofu.HookAction, error)

func (*UiHook) PreOpen

func (h *UiHook) PreOpen(addr addrs.AbsResourceInstance) (tofu.HookAction, error)

func (*UiHook) PrePlanImport

func (h *UiHook) PrePlanImport(addr addrs.AbsResourceInstance, target providers.ImportTarget) (tofu.HookAction, error)

func (*UiHook) PreProvisionInstanceStep

func (h *UiHook) PreProvisionInstanceStep(addr addrs.AbsResourceInstance, typeName string) (tofu.HookAction, error)

func (*UiHook) PreRefresh

func (h *UiHook) PreRefresh(addr addrs.AbsResourceInstance, gen states.Generation, priorState cty.Value) (tofu.HookAction, error)

func (*UiHook) PreRenew

func (h *UiHook) PreRenew(addr addrs.AbsResourceInstance) (tofu.HookAction, error)

func (*UiHook) ProvisionOutput

func (h *UiHook) ProvisionOutput(addr addrs.AbsResourceInstance, typeName string, msg string, configMarks cty.ValueMarks)

type Unlock

type Unlock interface {
	Diagnostics(diags tfdiags.Diagnostics)
	LockingDisabledForBackend()
	CannotUnlockByAnotherProcess()
	ForceUnlockCancelled()
	ForceUnlockSucceeded()

	// Backend returns the non-command view that contains methods to provide
	// progress output for the backend operations.
	Backend() Backend
}

func NewUnlock

func NewUnlock(args arguments.ViewOptions, view *View) Unlock

NewUnlock returns an initialized Unlock implementation for the given ViewType.

type UnlockHuman

type UnlockHuman struct {
	// contains filtered or unexported fields
}

func (*UnlockHuman) Backend

func (v *UnlockHuman) Backend() Backend

func (*UnlockHuman) CannotUnlockByAnotherProcess

func (v *UnlockHuman) CannotUnlockByAnotherProcess()

func (*UnlockHuman) Diagnostics

func (v *UnlockHuman) Diagnostics(diags tfdiags.Diagnostics)

func (*UnlockHuman) ForceUnlockCancelled

func (v *UnlockHuman) ForceUnlockCancelled()

func (*UnlockHuman) ForceUnlockSucceeded

func (v *UnlockHuman) ForceUnlockSucceeded()

func (*UnlockHuman) LockingDisabledForBackend

func (v *UnlockHuman) LockingDisabledForBackend()

type UnlockJSON

type UnlockJSON struct {
	// contains filtered or unexported fields
}

func (*UnlockJSON) Backend

func (v *UnlockJSON) Backend() Backend

func (*UnlockJSON) CannotUnlockByAnotherProcess

func (v *UnlockJSON) CannotUnlockByAnotherProcess()

func (*UnlockJSON) Diagnostics

func (v *UnlockJSON) Diagnostics(diags tfdiags.Diagnostics)

func (*UnlockJSON) ForceUnlockCancelled

func (v *UnlockJSON) ForceUnlockCancelled()

func (*UnlockJSON) ForceUnlockSucceeded

func (v *UnlockJSON) ForceUnlockSucceeded()

func (*UnlockJSON) LockingDisabledForBackend

func (v *UnlockJSON) LockingDisabledForBackend()

type UnlockMulti

type UnlockMulti []Unlock

func (UnlockMulti) Backend

func (m UnlockMulti) Backend() Backend

func (UnlockMulti) CannotUnlockByAnotherProcess

func (m UnlockMulti) CannotUnlockByAnotherProcess()

func (UnlockMulti) Diagnostics

func (m UnlockMulti) Diagnostics(diags tfdiags.Diagnostics)

func (UnlockMulti) ForceUnlockCancelled

func (m UnlockMulti) ForceUnlockCancelled()

func (UnlockMulti) ForceUnlockSucceeded

func (m UnlockMulti) ForceUnlockSucceeded()

func (UnlockMulti) LockingDisabledForBackend

func (m UnlockMulti) LockingDisabledForBackend()

type Validate

type Validate interface {
	// Results renders the diagnostics returned from a validation walk, and
	// returns a CLI exit code: 0 if there are no errors, 1 otherwise
	Results(diags tfdiags.Diagnostics) int

	// Diagnostics renders early diagnostics, resulting from argument parsing.
	Diagnostics(diags tfdiags.Diagnostics)
}

The Validate is used for the validate command.

func NewValidate

func NewValidate(args arguments.ViewOptions, view *View) Validate

NewValidate returns an initialized Validate implementation for the given ViewType.

type ValidateHuman

type ValidateHuman struct {
	// contains filtered or unexported fields
}

The ValidateHuman implementation renders diagnostics in a human-readable form, along with a success/failure message if OpenTofu is able to execute the validation walk.

func (*ValidateHuman) Diagnostics

func (v *ValidateHuman) Diagnostics(diags tfdiags.Diagnostics)

func (*ValidateHuman) Results

func (v *ValidateHuman) Results(diags tfdiags.Diagnostics) int

type ValidateJSON

type ValidateJSON struct {
	// contains filtered or unexported fields
}

The ValidateJSON implementation renders validation results as a JSON object. This object includes top-level fields summarizing the result, and an array of JSON diagnostic objects.

func (*ValidateJSON) Diagnostics

func (v *ValidateJSON) Diagnostics(diags tfdiags.Diagnostics)

Diagnostics should only be called if the validation walk cannot be executed. In this case, we choose to render human-readable diagnostic output, primarily for backwards compatibility.

func (*ValidateJSON) Results

func (v *ValidateJSON) Results(diags tfdiags.Diagnostics) int

type ValidateMulti

type ValidateMulti []Validate

func (ValidateMulti) Diagnostics

func (m ValidateMulti) Diagnostics(diags tfdiags.Diagnostics)

Diagnostics renders early diagnostics, resulting from argument parsing.

func (ValidateMulti) Results

func (m ValidateMulti) Results(diags tfdiags.Diagnostics) int

Results renders the diagnostics returned from a validation walk, and returns a CLI exit code: 0 if there are no errors, 1 otherwise

type Version

type Version interface {
	Diagnostics(diags tfdiags.Diagnostics)
	// PrintVersion returns true if the printing has been done successfully and false otherwise.
	PrintVersion(version string, versionPrerelease string, platform string, fipsEnabled bool, providerVersions map[string]string) bool
}

func NewVersion

func NewVersion(args arguments.ViewOptions, view *View) Version

NewVersion returns an initialized Version implementation for the given ViewType. This view behaves differently from the general approach since the JSON format is not meant to follow the general JSON format. Instead, the view that is returned will always print diagnostics in human format while Version.PrintVersion will return different results based on the [arguments.ViewOptions#ViewType].

type VersionMixed

type VersionMixed struct {
	// contains filtered or unexported fields
}

func (*VersionMixed) Diagnostics

func (v *VersionMixed) Diagnostics(diags tfdiags.Diagnostics)

func (*VersionMixed) PrintVersion

func (v *VersionMixed) PrintVersion(version string, versionPrerelease string, platform string, fipsEnabled bool, providerVersions map[string]string) bool

type View

type View struct {

	// ModuleDeprecationWarnLvl is used to filter out deprecation warnings for outputs and variables as requested by the user.
	ModuleDeprecationWarnLvl arguments.DeprecationWarningLevel
	// contains filtered or unexported fields
}

View is the base layer for command views, encapsulating a set of I/O streams, a colorize implementation, and implementing a human friendly view for diagnostics.

func NewView

func NewView(streams *terminal.Streams) *View

Initialize a View with the given streams, a disabled colorize object, and a no-op configSources callback.

func (*View) Colorize

func (v *View) Colorize() *colorstring.Colorize

Colorize returns the colorstring.Colorize object within to be used in other places. TODO meta-refactor: this is a temporary solution. This should not be exposed. Whoever needs to use this

should do it through a View implementation instead.

func (*View) Configure

func (v *View) Configure(view *arguments.View)

Configure applies the global view configuration flags.

func (*View) DeprecationDiagnosticAllowed

func (v *View) DeprecationDiagnosticAllowed(diag tfdiags.Diagnostic, seen DeprecationDiagnosticAllowedSeen) bool

DeprecationDiagnosticAllowed is used to determine if a diagnostic generated by a deprecation check against an output or a variable should be allowed to be shown to the user based on the given DeprecationWarningLevel. This is making use of tfdiags.Diagnostic#ExtraInfo() to figure out if the diagnostic is generated by a deprecation check.

func (*View) DeprecationKeyExtra

func (v *View) DeprecationKeyExtra(diag tfdiags.Diagnostic) string

func (*View) Diagnostics

func (v *View) Diagnostics(diags tfdiags.Diagnostics)

Diagnostics renders a set of warnings and errors in human-readable form. Warnings are printed to stdout, and errors to stderr.

func (*View) DiagsWithNewline

func (v *View) DiagsWithNewline()

func (*View) HelpPrompt

func (v *View) HelpPrompt(command string)

HelpPrompt is intended to be called from commands which fail to parse all of their CLI arguments successfully. It refers users to the full help output rather than rendering it directly, which can be overwhelming and confusing.

func (*View) RunningInAutomation

func (v *View) RunningInAutomation() bool

func (*View) SetConfigSources

func (v *View) SetConfigSources(cb func() map[string]*hcl.File)

SetConfigSources overrides the default no-op callback with a new function pointer, and should be called when the config loader is initialized.

func (*View) SetIsRemoteModuleSource

func (v *View) SetIsRemoteModuleSource(cb func(addrs.Module) bool)

func (*View) SetModuleSourceAddrs

func (v *View) SetModuleSourceAddrs(cb func(addrs.Module) addrs.ModuleSource)

func (*View) SetRunningInAutomation

func (v *View) SetRunningInAutomation(new bool) *View

SetRunningInAutomation modifies the view's "running in automation" flag, which causes some slight adjustments to certain messages that would normally suggest specific OpenTofu commands to run, to make more conceptual gestures instead for situations where the user isn't running OpenTofu directly.

For convenient use during initialization (in conjunction with NewView), SetRunningInAutomation returns the receiver after modifying it.

func (*View) SetShowSensitive

func (v *View) SetShowSensitive(showSensitive bool)

func (*View) SetVerbose added in v0.3.0

func (v *View) SetVerbose(verbose bool)

SetVerbose sets the view's verbose flag. See the verbose field's own comment for why this is a setter called from a command's own -verbose flag rather than something View.Configure reads off arguments.View.

func (*View) StdinPiped

func (v *View) StdinPiped() bool

StdinPiped returns true if the input is piped.

type ViewUiHuman

type ViewUiHuman struct {
	// contains filtered or unexported fields
}

ViewUiHuman is a Ui implementation that colors its output according to the given color schemes for the given type of output.

func (*ViewUiHuman) Ask

func (u *ViewUiHuman) Ask(query string) (string, error)

func (*ViewUiHuman) AskSecret

func (u *ViewUiHuman) AskSecret(query string) (string, error)

func (*ViewUiHuman) Error

func (u *ViewUiHuman) Error(message string)

func (*ViewUiHuman) Info

func (u *ViewUiHuman) Info(message string)

func (*ViewUiHuman) Output

func (u *ViewUiHuman) Output(message string)

func (*ViewUiHuman) Warn

func (u *ViewUiHuman) Warn(message string)

type ViewUiJSON

type ViewUiJSON struct {
	// contains filtered or unexported fields
}

ViewUiJSON is a Ui implementation that colors its output according to the given color schemes for the given type of output.

func (*ViewUiJSON) Ask

func (u *ViewUiJSON) Ask(_ string) (string, error)

func (*ViewUiJSON) AskSecret

func (u *ViewUiJSON) AskSecret(_ string) (string, error)

func (*ViewUiJSON) Error

func (u *ViewUiJSON) Error(message string)

func (*ViewUiJSON) Info

func (u *ViewUiJSON) Info(message string)

func (*ViewUiJSON) Output

func (u *ViewUiJSON) Output(message string)

func (*ViewUiJSON) Warn

func (u *ViewUiJSON) Warn(message string)

type ViewUiMulti

type ViewUiMulti []cli.Ui

ViewUiMulti is a Ui implementation that colors its output according to the given color schemes for the given type of output.

func (ViewUiMulti) Ask

func (u ViewUiMulti) Ask(query string) (string, error)

func (ViewUiMulti) AskSecret

func (u ViewUiMulti) AskSecret(query string) (string, error)

func (ViewUiMulti) Error

func (u ViewUiMulti) Error(message string)

func (ViewUiMulti) Info

func (u ViewUiMulti) Info(message string)

func (ViewUiMulti) Output

func (u ViewUiMulti) Output(message string)

func (ViewUiMulti) Warn

func (u ViewUiMulti) Warn(message string)

type Workspace

type Workspace interface {
	Diagnostics(diags tfdiags.Diagnostics)

	// General workspace messages
	WorkspaceDoesNotExist(name string)
	WorkspaceInvalidName(name string)
	WorkspaceCreated(name string)
	WarnWhenUsedAsEnvCmd(usedAsEnvCmd bool)

	// `tofu workspace new` specific
	WorkspaceAlreadyExists(name string)
	WorkspaceIsOverriddenNewError()

	// `tofu workspace list` specific
	ListWorkspaces(workspaces []string, current string)
	WorkspaceOverwrittenByEnvVarWarn()

	// `tofu workspace select` specific
	WorkspaceChanged(name string)
	WorkspaceIsOverriddenSelectError()

	// `tofu workspace delete` specific
	WorkspaceDeleted(name string)
	DeletedWorkspaceNotEmpty(name string)
	CannotDeleteCurrentWorkspace(name string)

	// `tofu workspace show` specific
	WorkspaceShow(name string)

	// Backend returns the non-command view that contains methods to provide
	// progress output for the backend operations.
	Backend() Backend
}

func NewWorkspace

func NewWorkspace(args arguments.ViewOptions, view *View) Workspace

NewWorkspace returns an initialized Workspace implementation for the given ViewType.

type WorkspaceHuman

type WorkspaceHuman struct {
	// contains filtered or unexported fields
}

func (*WorkspaceHuman) Backend

func (v *WorkspaceHuman) Backend() Backend

func (*WorkspaceHuman) CannotDeleteCurrentWorkspace

func (v *WorkspaceHuman) CannotDeleteCurrentWorkspace(name string)

func (*WorkspaceHuman) DeletedWorkspaceNotEmpty

func (v *WorkspaceHuman) DeletedWorkspaceNotEmpty(name string)

func (*WorkspaceHuman) Diagnostics

func (v *WorkspaceHuman) Diagnostics(diags tfdiags.Diagnostics)

func (*WorkspaceHuman) ListWorkspaces

func (v *WorkspaceHuman) ListWorkspaces(workspaces []string, current string)

func (*WorkspaceHuman) WarnWhenUsedAsEnvCmd

func (v *WorkspaceHuman) WarnWhenUsedAsEnvCmd(usedAsEnvCmd bool)

func (*WorkspaceHuman) WorkspaceAlreadyExists

func (v *WorkspaceHuman) WorkspaceAlreadyExists(name string)

func (*WorkspaceHuman) WorkspaceChanged

func (v *WorkspaceHuman) WorkspaceChanged(name string)

func (*WorkspaceHuman) WorkspaceCreated

func (v *WorkspaceHuman) WorkspaceCreated(name string)

func (*WorkspaceHuman) WorkspaceDeleted

func (v *WorkspaceHuman) WorkspaceDeleted(name string)

func (*WorkspaceHuman) WorkspaceDoesNotExist

func (v *WorkspaceHuman) WorkspaceDoesNotExist(name string)

func (*WorkspaceHuman) WorkspaceInvalidName

func (v *WorkspaceHuman) WorkspaceInvalidName(name string)

func (*WorkspaceHuman) WorkspaceIsOverriddenNewError

func (v *WorkspaceHuman) WorkspaceIsOverriddenNewError()

func (*WorkspaceHuman) WorkspaceIsOverriddenSelectError

func (v *WorkspaceHuman) WorkspaceIsOverriddenSelectError()

func (*WorkspaceHuman) WorkspaceOverwrittenByEnvVarWarn

func (v *WorkspaceHuman) WorkspaceOverwrittenByEnvVarWarn()

func (*WorkspaceHuman) WorkspaceShow

func (v *WorkspaceHuman) WorkspaceShow(name string)

type WorkspaceJSON

type WorkspaceJSON struct {
	// contains filtered or unexported fields
}

func (*WorkspaceJSON) Backend

func (v *WorkspaceJSON) Backend() Backend

func (*WorkspaceJSON) CannotDeleteCurrentWorkspace

func (v *WorkspaceJSON) CannotDeleteCurrentWorkspace(name string)

func (*WorkspaceJSON) DeletedWorkspaceNotEmpty

func (v *WorkspaceJSON) DeletedWorkspaceNotEmpty(name string)

func (*WorkspaceJSON) Diagnostics

func (v *WorkspaceJSON) Diagnostics(diags tfdiags.Diagnostics)

func (*WorkspaceJSON) ListWorkspaces

func (v *WorkspaceJSON) ListWorkspaces(workspaces []string, current string)

func (*WorkspaceJSON) WarnWhenUsedAsEnvCmd

func (v *WorkspaceJSON) WarnWhenUsedAsEnvCmd(usedAsEnvCmd bool)

func (*WorkspaceJSON) WorkspaceAlreadyExists

func (v *WorkspaceJSON) WorkspaceAlreadyExists(name string)

func (*WorkspaceJSON) WorkspaceChanged

func (v *WorkspaceJSON) WorkspaceChanged(name string)

func (*WorkspaceJSON) WorkspaceCreated

func (v *WorkspaceJSON) WorkspaceCreated(name string)

func (*WorkspaceJSON) WorkspaceDeleted

func (v *WorkspaceJSON) WorkspaceDeleted(name string)

func (*WorkspaceJSON) WorkspaceDoesNotExist

func (v *WorkspaceJSON) WorkspaceDoesNotExist(name string)

func (*WorkspaceJSON) WorkspaceInvalidName

func (v *WorkspaceJSON) WorkspaceInvalidName(name string)

func (*WorkspaceJSON) WorkspaceIsOverriddenNewError

func (v *WorkspaceJSON) WorkspaceIsOverriddenNewError()

func (*WorkspaceJSON) WorkspaceIsOverriddenSelectError

func (v *WorkspaceJSON) WorkspaceIsOverriddenSelectError()

func (*WorkspaceJSON) WorkspaceOverwrittenByEnvVarWarn

func (v *WorkspaceJSON) WorkspaceOverwrittenByEnvVarWarn()

func (*WorkspaceJSON) WorkspaceShow

func (v *WorkspaceJSON) WorkspaceShow(name string)

type WorkspaceMulti

type WorkspaceMulti []Workspace

func (WorkspaceMulti) Backend

func (m WorkspaceMulti) Backend() Backend

func (WorkspaceMulti) CannotDeleteCurrentWorkspace

func (m WorkspaceMulti) CannotDeleteCurrentWorkspace(name string)

func (WorkspaceMulti) DeletedWorkspaceNotEmpty

func (m WorkspaceMulti) DeletedWorkspaceNotEmpty(name string)

func (WorkspaceMulti) Diagnostics

func (m WorkspaceMulti) Diagnostics(diags tfdiags.Diagnostics)

func (WorkspaceMulti) ListWorkspaces

func (m WorkspaceMulti) ListWorkspaces(workspaces []string, current string)

func (WorkspaceMulti) WarnWhenUsedAsEnvCmd

func (m WorkspaceMulti) WarnWhenUsedAsEnvCmd(usedAsEnvCmd bool)

func (WorkspaceMulti) WorkspaceAlreadyExists

func (m WorkspaceMulti) WorkspaceAlreadyExists(name string)

func (WorkspaceMulti) WorkspaceChanged

func (m WorkspaceMulti) WorkspaceChanged(name string)

func (WorkspaceMulti) WorkspaceCreated

func (m WorkspaceMulti) WorkspaceCreated(name string)

func (WorkspaceMulti) WorkspaceDeleted

func (m WorkspaceMulti) WorkspaceDeleted(name string)

func (WorkspaceMulti) WorkspaceDoesNotExist

func (m WorkspaceMulti) WorkspaceDoesNotExist(name string)

func (WorkspaceMulti) WorkspaceInvalidName

func (m WorkspaceMulti) WorkspaceInvalidName(name string)

func (WorkspaceMulti) WorkspaceIsOverriddenNewError

func (m WorkspaceMulti) WorkspaceIsOverriddenNewError()

func (WorkspaceMulti) WorkspaceIsOverriddenSelectError

func (m WorkspaceMulti) WorkspaceIsOverriddenSelectError()

func (WorkspaceMulti) WorkspaceOverwrittenByEnvVarWarn

func (m WorkspaceMulti) WorkspaceOverwrittenByEnvVarWarn()

func (WorkspaceMulti) WorkspaceShow

func (m WorkspaceMulti) WorkspaceShow(name string)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL