views

package
v0.17.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	// SchemaSourceProvider means the provider's own schemas were read and
	// backed the classification in this document.
	SchemaSourceProvider = "provider"

	// SchemaSourceBuiltin means no provider schema was available, so
	// whatever fallback the classification has - internal/live/check's
	// built-in admission table for a rung, no taggability answer at all for
	// a gap - is what produced the answer.
	SchemaSourceBuiltin = "builtin"
)

SchemaSourceProvider and SchemaSourceBuiltin are the two values the "schemas" field carries on every JSON document this package prints whose content depends on having read a provider's schemas: "choudoufu live-check -json"'s rungs and "choudoufu live-ls -json DIR"'s declared-instance gaps, both of which degrade rather than refuse when the directory was never initialized.

GitHub issue #966: before this, the degraded answer and the accurate one were the same shape, the same keys and the same exit code, so a scripted reader could not tell them apart. The remedy the help text names is "choudoufu init"; these values say whether it is still needed.

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 AdoptionOnlyPlan added in v0.5.0

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

AdoptionOnlyPlan wraps a Plan view so that the resource diff is not printed, for GitHub issue #587's "-adoption-only" mode.

The mode's whole point is legibility during a migration. live/e2e/terralith-scale/MIGRATION.md measured the plan-based adoption loop at 2,885 lines for 55 resources and 7,649 for 205, of which the sections carrying an adoption path were 5.6% and 5.5%. Leaving the diff in and adding a ledger above it would move that ratio by a page and fix nothing: the operator would still be scrolling a several-thousand-line report to find the part that answers the question they asked.

Three things are suppressed: the rendered diff, the next-step hint that follows it, and the BODY of every warning - never a warning's existence, and never an error.

The warnings are here because dropping the diff alone did not fix the reported problem. Measured against live/e2e/estate-block plus an IAM role and its inline policy, on the pinned emulator: a plain plan is 926 lines, dropping the diff and the other sections leaves 500, and 470 of those 500 are warning bodies - 36 "Incomplete sweep for undeclared resources", one per provider type the emulator cannot list, at 8 to 9 lines each. That is the [OBJECT_UNTAGGED] floor live/e2e/terralith-scale/MIGRATION.md measured as most of the noise, and it is bounded by the provider's type count rather than by the estate, so it does not shrink as the signal grows.

So each warning is rendered as one line - its summary, with a count when the same summary recurs - under a heading that says how many there were and how to read them in full. Nothing is hidden: every warning the run produced is still named on screen, and the sentence pointing at plain "choudoufu plan" is printed with them rather than left to be guessed.

Errors are never touched. Interrupts, the backend's own progress and the emergency state dump all pass straight through, because a mode that hid a failure while claiming to summarize adoption would be worse than the noise it removes.

This type is a view, not a pipeline mode: the projection and the plan graph are the same, so a resource's adoption verdict here is the same verdict the run would have printed without the flag, which is the property that makes the ledger trustworthy.

What the FLAG does beyond selecting this view has changed since the CollectUnclaimed ruling (#604), and the sentence that used to sit here ("the same live reads, the same discovery sweep ... the flag buys no time") is no longer true of it: -adoption-only now also asks the estate-wide sweep which live resources carry no ownership marker at all, so it reads MORE than an ordinary plan rather than the same. See [command.collectUnclaimedSetting]. Nothing about this view changed; only what the run it renders went and looked at.

func (*AdoptionOnlyPlan) Backend added in v0.5.0

func (v *AdoptionOnlyPlan) Backend() Backend

func (*AdoptionOnlyPlan) Diagnostics added in v0.5.0

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

func (*AdoptionOnlyPlan) HelpPrompt added in v0.5.0

func (v *AdoptionOnlyPlan) HelpPrompt()

func (*AdoptionOnlyPlan) Hooks added in v0.5.0

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

func (*AdoptionOnlyPlan) Operation added in v0.5.0

func (v *AdoptionOnlyPlan) Operation() Operation

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 was no JSON implementation before GitHub issue #790: the other consumer of this analysis, tools/corpus-gen, calls internal/live/check directly rather than parsing command output, and nothing outside this repository had a reason to run the binary at all. #790 is that reason - behold, named in the issue, draws an estate as boxes with cross-member edges and parses no HCL of its own by design, so it needs the compiler's own output the way a chant project's compiler already gives it one. See NewLiveCheckJSON.

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 LiveCheckInstance added in v0.12.0

type LiveCheckInstance struct {
	Address string `json:"address"`
	Type    string `json:"type,omitempty"`
	Rung    string `json:"rung,omitempty"`
	Refused bool   `json:"refused,omitempty"`
	Rule    string `json:"rule,omitempty"`
	Reason  string `json:"reason,omitempty"`
}

LiveCheckInstance is one declared address in #790's roster: an [check.Instance] shaped for JSON, with the field names the issue's own Ask fixes ("instances[]: address, type, rung ..., and for a refused instance the rule and the reason").

type LiveCheckJSON added in v0.12.0

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

LiveCheckJSON is the machine-readable implementation GitHub issue #790 adds. See NewLiveCheckJSON.

func NewLiveCheckJSON added in v0.12.0

func NewLiveCheckJSON(view *View) *LiveCheckJSON

NewLiveCheckJSON returns #790's roster writer: the same LiveCheckReport LiveCheckHuman renders as prose, marshaled instead as the document [liveCheckDocument] shapes. No cloud call happens here either - it renders exactly the [check.Report] [LiveCheckCommand.liveCheck] already computed, the same as the human path.

func (*LiveCheckJSON) Report added in v0.12.0

func (v *LiveCheckJSON) Report(rep LiveCheckReport)

Report marshals rep as one JSON document and prints it, newline- terminated. Instances and References are never nil in the printed document even when empty - encoding/json renders a nil slice as `null`, and a roster reading "null" rather than "[]" would make a caller check for a case that is not actually different from zero entries.

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 LiveCheckReference added in v0.12.0

type LiveCheckReference struct {
	From    string   `json:"from"`
	Estate  string   `json:"estate"`
	Address string   `json:"address,omitempty"`
	ReadBy  []string `json:"read_by,omitempty"`
}

LiveCheckReference is one cross-estate edge: a [check.Reference] shaped for JSON, with the field names the issue's own Ask fixes ("references[]: every data source whose filters name tag:tofu-estate ..., as {from, estate, address}, plus the resources in this configuration that read it").

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

	// Estate is the name this configuration's own "live" block declares,
	// when it declares one and sets the argument - [check.Report.Estate]
	// passed straight through. Empty for most directories this command
	// runs against, since it runs with no live block by design. Printed
	// only by -json (see [LiveCheckJSON.Report]): the human report has
	// never named the estate, and #790 does not ask it to start.
	Estate string

	// InstanceRoster and References are GitHub issue #790's declared
	// roster: every instance this analysis named an address for
	// ([check.Report.Roster]), and every cross-estate data-source edge
	// live/OUTPUTS.md's pattern describes ([check.Report.References]).
	// Both are empty in the human report - [LiveCheckJSON.Report] is their
	// sole reader - because the text report already carries the same facts
	// one summarized count at a time (Instances above, and the Findings a
	// refused instance falls under) and #790 asks for a per-instance
	// restatement in JSON, not a new paragraph in the prose.
	InstanceRoster []LiveCheckInstance
	References     []LiveCheckReference
}

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 LiveLs added in v0.12.0

type LiveLs interface {
	Report(rep LiveLsReport)
}

LiveLs renders what "choudoufu live-ls" prints. Diagnostics do not come through here; they go to View like every other command's - see LiveCheck's own doc comment for the same convention.

func NewLiveLs added in v0.12.0

func NewLiveLs(args arguments.ViewOptions, view *View) LiveLs

NewLiveLs returns the LiveLs implementation for args.ViewType: the JSON implementation GitHub issue #789 asks for by name, or the ordinary human report every other live-* command already has one of.

type LiveLsGap added in v0.12.0

type LiveLsGap struct {
	// Address is the declared instance's address, exactly as
	// [addrs.AbsResourceInstance.String] renders it.
	Address string

	// Type is the resource type.
	Type string

	// Rung is "record" for an instance whose identity lives in the estate's
	// record store rather than on a cloud object's tags (GitHub issue
	// #417's record-carried tier, and #73's RECORD_ADMITTED / #270's
	// located-identity types both land here), or "declaration-carried" for
	// one whose type carries no settable tags argument at all, so no marker
	// was ever written for it to be found by (#417's declaration-carried
	// tier). Never anything else: an instance on the marker-carried tier
	// that this listing still could not find is a genuine absence, not a
	// gap, and is left out of this list entirely - see the command
	// package's own classification.
	Rung string

	// Detail is one sentence explaining Rung, aimed at a reader who has
	// never read live/MARKERS.md's tier definitions.
	Detail string
}

LiveLsGap is one declared instance the listing itself cannot see, and why.

type LiveLsHuman added in v0.12.0

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

LiveLsHuman writes the report as text: one line per item, then the gap section when a configuration directory was given.

func (*LiveLsHuman) Report added in v0.12.0

func (v *LiveLsHuman) Report(rep LiveLsReport)

type LiveLsItem added in v0.12.0

type LiveLsItem struct {
	// ID is the resource's ARN, or another stable identity when the
	// discovery path that found it (today, only the IAM native path) has no
	// ARN in hand at the point of listing - which does not happen for IAM,
	// since a role's ListRoles entry always carries its own Arn, but is
	// stated here because Source names a second path this field's contract
	// has to hold for.
	ID string

	// Type is the resource's type: the resource type name decoded from its
	// own tofu-address marker when that marker parses, or, when it does
	// not, a coarse ARN-derived label ("service:resource-type" or bare
	// "service") - the same approximation
	// examples/live-mv-workbench/tlmig/govern.py's read_inventory (the
	// prior art GitHub issue #789 names) uses for every item, unconditionally.
	Type string

	// Address is the unescaped configuration address decoded from
	// tofu-address and its continuation tags, per live/MARKERS.md - empty
	// when the resource carries no readable tofu-address marker at all
	// (malformed, or genuinely absent despite carrying tofu-estate, which
	// live/MARKERS.md calls out as a possible, if unusual, state).
	Address string

	// Slot is the tofu-slot marker value, empty when absent.
	Slot string

	// Declared is whether Address matches a declared instance in ConfigDir,
	// meaningful only when ConfigDir is non-empty (always false otherwise -
	// nothing to compare against).
	Declared bool

	// Source names which pass found this item: "tagging" for the Resource
	// Groups Tagging API's estate-wide GetResources call, or "iam" for the
	// second pass over iam:ListRoles/iam:ListRoleTags GitHub issue #789
	// asks for by name, because the tagging index does not serve IAM on a
	// real account. An item the tagging pass already found is never
	// reported a second time under "iam", even when the IAM pass would
	// have found it too - see the command package's own dedup-by-ARN.
	Source string

	// Tags are every marker tag this resource carries, unmodified - the raw
	// material GitHub issue #789 asks for alongside the decoded fields
	// above.
	Tags map[string]string
}

LiveLsItem is one live resource carrying the listed estate's marker.

type LiveLsJSON added in v0.12.0

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

LiveLsJSON writes the report as one JSON object, so a scripted reader - GitHub issue #789 names behold - never parses prose.

func (*LiveLsJSON) Report added in v0.12.0

func (v *LiveLsJSON) Report(rep LiveLsReport)

type LiveLsReport added in v0.12.0

type LiveLsReport struct {
	// Estate is the tofu-estate value that was listed.
	Estate string

	// Region is the region the Tagging API and IAM calls were sent to, or
	// empty when none was named and the AWS SDK's own default resolution
	// picked one this command never learns.
	Region string

	// Consistent is whether -consistent was passed, and Stabilized is
	// whether two consecutive reads agreed before Attempts ran out - see
	// [command.pollConsistent]. Stabilized is always true when Consistent is
	// false: a single read has nothing to disagree with itself about.
	Consistent bool
	Stabilized bool
	Attempts   int

	// ConfigDir is the configuration directory the listing was
	// cross-referenced against, or empty when none was given - see
	// LiveLs.ConfigDir's own doc comment in the arguments package.
	ConfigDir string

	// Items is every resource the listing found, in the order
	// [LiveLsReport] is built in - already sorted by type then address then
	// id.
	Items []LiveLsItem

	// Gaps are declared instances a configuration directory named that the
	// listing itself cannot see, each with the rung that explains why: the
	// tier definitions (#417)'s record-carried and declaration-carried
	// tiers name resources with no marker to find at all, ever, which this
	// listing's whole mechanism is reading markers. Empty when ConfigDir is
	// empty.
	//
	// An empty list is only meaningful alongside GapsSkipped and Schemas
	// below: see GitHub issue #966.
	Gaps []LiveLsGap

	// GapsSkipped is why the declared-instance comparison did not run,
	// empty when it ran to completion. GitHub issue #966: an empty Gaps
	// means two opposite things - the comparison ran and found nothing, or
	// it never ran - and the -json document made the second one look like
	// the first by omitting the key entirely.
	//
	// It carries the same sentence [command.LiveLsCommand.liveLsGaps]'
	// "Declared-instance comparison skipped" warning carries, so the
	// document and the warning cannot say different things, and it is also
	// set when no configuration directory was given at all - the case where
	// there is nothing to compare and an empty list would otherwise read as
	// a comparison that found nothing.
	GapsSkipped string

	// Schemas is whether the declared-instance comparison read the
	// provider's own resource schemas. Without them
	// [command.liveLsRung]'s [markers.Taggable] check cannot run, so the
	// declaration-carried rung - the larger half of what this comparison
	// exists to report - classifies nothing and every such instance drops
	// silently out of Gaps.
	//
	// False when no comparison ran at all, which GapsSkipped then explains.
	Schemas bool
}

LiveLsReport is what "choudoufu live-ls" prints, in a form this package can render without importing internal/live/cloudcontrol or internal/live/markers: the command package decides what is true (which resources carry the estate's marker, which ones a configuration declares but the listing cannot see, and why), and this package decides how it reads. Both LiveLsHuman and LiveLsJSON render the same report, which is what lets behold - the named consumer in GitHub issue #789 - trust that the JSON it parses and the text a human reads describe the same run.

type LivePlanAdoptable added in v0.15.0

type LivePlanAdoptable struct {
	// Addr is the declared instance the live resource matched.
	Addr string `json:"addr"`

	// TypeName and LiveID are the resource type and the identity the live
	// resource was found with - what "adopt with" below writes the two
	// markers onto.
	TypeName string `json:"type"`
	LiveID   string `json:"identity"`

	// Matched are the identity-bearing arguments the live resource and the
	// declared instance agreed on exactly, in the order the matcher
	// compared them - the "matched on:" line of the human render.
	Matched []LivePlanMatchedArgument `json:"matched"`

	// MarkerEstate and MarkerAddress are the tofu-estate and tofu-address
	// values that adopt the resource, the same pair [StatelessUnowned]
	// carries under the same names.
	MarkerEstate  string `json:"adopt_tofu_estate"`
	MarkerAddress string `json:"adopt_tofu_address"`

	// AdoptCommand is the one-line AWS CLI command that writes those two
	// tags, exactly as the human render prints it after "adopt with:",
	// empty for a type stateless mode has no command for. Informational: a
	// consumer that writes markers itself uses the two fields above.
	AdoptCommand string `json:"adopt_command,omitempty"`
}

LivePlanAdoptable is one content-matched live resource in LivePlanDocument.Adoptable: StatelessBindCandidate in the wire form INTENTIUS/chant's terraform lexicon reads (chant #2168), which is why the field names follow StatelessUnowned's rather than the Go type's - a consumer that already handles an unowned row handles this one with the same code, plus the match.

type LivePlanBound added in v0.12.0

type LivePlanBound struct {
	// Addr is the declared instance's own address.
	Addr string `json:"addr"`

	// TypeName is the resource type.
	TypeName string `json:"type"`

	// Identity is the live id this instance bound to - an ARN, a
	// server-assigned ID, or whatever join the type's own identity
	// convention produces (live/MARKERS.md and the identity table govern
	// the shape). It is whatever the projection actually matched on:
	// [projection.Result.BoundIdentity], not the pre-projection
	// [identity.Resolution.ImportID], which for three of the four
	// [LivePlanBoundSource] paths is empty at the moment the row is built.
	//
	// ALWAYS PRESENT on the wire since GitHub issue #967, including as ""
	// - no omitempty, deliberately. It used to be omitted whenever it was
	// empty, which made the one row shape that was FOUND by its live
	// identity (a marker-bound instance) the one shape that could not
	// state it, and left a reader joining on Addr instead. behold pairs a
	// bound row with the live-ls item carrying the same id, so a key that
	// comes and goes with the tag index's freshness is worse for it than
	// a key that is sometimes "".
	//
	// Empty for exactly one shape: a record-backed instance (GitHub issue
	// #73, identity.ClassRecordBacked), whose values live in the estate's
	// record store and which has no cloud object for an id to name. Never
	// invented for one - a row with no live id says so.
	Identity string `json:"identity"`

	// IdentityValues is the identity broken out one component at a time -
	// [identity.Resolution.IdentityValues] - when the resolver kept that
	// form; nil whenever it did not (a marker-bound instance carries only
	// the joined Identity string, never this map - see
	// [identity.Resolution.IdentityValues]'s own doc comment).
	IdentityValues map[string]string `json:"identity_values,omitempty"`

	// Source is which admission path supplied Identity.
	Source LivePlanBoundSource `json:"source"`
}

LivePlanBound is one declared instance the projection actually admitted into prior state, and how - GitHub issue #788's "bound[]".

type LivePlanBoundSource added in v0.12.0

type LivePlanBoundSource string

LivePlanBoundSource is which of this fork's admission paths supplied a LivePlanBound entry's identity - GitHub issue #788's own vocabulary for "bound[]", independent of issue #790's rung vocabulary for live-check (tag-governable / declaration-carried / record-only): the two issues were worked in parallel over the same identity and discovery packages, and #788's Ask defines these four values on its own terms rather than borrowing #790's. A shared enum may make sense once both have landed and someone can see both call sites at once; inventing one now, from one side, would be guessing at the other issue's needs.

const (
	// LivePlanBoundMarker means this instance's identity came from the
	// estate-wide marker sweep (internal/live/discovery): the live object
	// carried this estate's tofu-estate/tofu-address tags, and that is how
	// the plan found it. This is the tag-governed path IAM can condition on.
	//
	// More precisely, it means the sweep is what this instance was WAITING
	// on: [statelessBoundReport in package command] classifies by the
	// pre-sweep identity.ClassNeedsDiscovery set, which is the only thing
	// left once binding has rewritten the resolution. An instance the
	// sweep did not manage to bind - a real account's tag index lags a
	// write by minutes - can still be materialized from its record by
	// GitHub issue #364's record-first read and reach a reader here. The
	// [LivePlanBound.Identity] such a row carries is the record's, and
	// names the same live object either way; only the provenance this
	// value states is approximate. GitHub issue #967 found it while
	// fixing the identity and deliberately did not move it: narrowing
	// this value is a change to what an existing key MEANS, which needs
	// its own issue and its own word with the consumers.
	LivePlanBoundMarker LivePlanBoundSource = "marker"

	// LivePlanBoundRecord means this instance's identity came from the
	// estate's own record store rather than from a tag on the object
	// itself (identity.ClassRecordBacked / identity.ClassRecordLocated -
	// GitHub issues #73 and #270). Never produced by
	// [statelessBoundReport in package command]'s own "-estate" form,
	// which has no live block and therefore never opens a record store -
	// see that function's own doc comment for why the value stays defined
	// here anyway.
	LivePlanBoundRecord LivePlanBoundSource = "record"

	// LivePlanBoundDerived means this instance's identity was computed
	// straight from configuration - a name already in the resource block,
	// or a formula over parent resources' own live IDs
	// (identity.ClassConcrete / identity.ClassParentDerived) - with no
	// marker sweep and no record store involved at all.
	LivePlanBoundDerived LivePlanBoundSource = "derived"

	// LivePlanBoundCache means this instance's identity was answered from
	// GitHub issue #685's local state cache
	// (projection.Options.StateCache) instead of a live read this run
	// made. Never produced by live-plan's own "-estate" form: that
	// pipeline "neither reads nor writes the #685 state cache" by design
	// (this fork's own doc comment on LivePlanCommand), so every bound
	// entry this command emits reflects a read made THIS run, live. The
	// value stays defined for the day plain "choudoufu plan"/"apply"
	// under a live block (live_mode.go's own pipeline, which does open
	// the cache) grows the same -json document.
	LivePlanBoundCache LivePlanBoundSource = "cache"
)

type LivePlanDiagnostic added in v0.12.0

type LivePlanDiagnostic struct {
	// Severity is "error" or "warning" (tfdiags.Diagnostic.Severity's own
	// String()).
	Severity string `json:"severity"`
	Summary  string `json:"summary"`
	Detail   string `json:"detail,omitempty"`
}

LivePlanDiagnostic is one warning or error a live-plan -json run raised, in the minimal form LivePlanDocument.Diagnostics carries them in. Not jsonentities.Diagnostic (the general UI-message stream's own diagnostic shape, snippet and all) on purpose: that type's extra detail - source ranges, config snippets - answers "where in the configuration" for a diagnostic tied to one, and every diagnostic this specific field carries is a run-level finding (a state file sitting in the working directory, a provider version skew) with no configuration range to point at in the first place.

type LivePlanDocument added in v0.12.0

type LivePlanDocument struct {
	// Estate is this run's estate name, exactly as [LivePlanBound],
	// omissions and unowned were all computed against - empty only when
	// the run had none to search by, which every other section already
	// degrades gracefully for (see statelessEstateFor's own callers).
	Estate string `json:"estate"`

	// ChoudoufuVersion is this fork's own release tag (tfversion.Fork),
	// empty on a development build - the same value the version command's
	// human-readable output names "choudoufu %s" and its own "-json"
	// output does not carry at all (views/version.go's versionOutput has
	// no field for it). A snapshot naming what produced it needs this even
	// when the version command's own JSON does not yet.
	ChoudoufuVersion string `json:"choudoufu_version"`

	// UpstreamVersion is the pinned OpenTofu base version this build's
	// engine is (tfversion.String(), the same value the version command's
	// human output prints as "OpenTofu v%s" and its JSON output carries as
	// "terraform_version") - the other half of "what produced it": a
	// choudoufu release and the upstream OpenTofu release it forked its
	// engine from are two different version numbers, and a renderer
	// comparing behaviour across snapshots needs to know both.
	UpstreamVersion string `json:"upstream_version"`

	// Bound is every declared instance the plan admitted into prior state,
	// and how - see [LivePlanBound].
	Bound []LivePlanBound `json:"bound"`

	// Omissions is every declared instance the plan could not read from
	// the live system, and why - the same value the human-readable
	// "Omissions" section already renders as prose ([StatelessOmission]).
	Omissions []StatelessOmission `json:"omissions"`

	// Unowned is every live resource found at a declared identity without
	// this estate's marker - the same value the human-readable "Unowned"
	// section already renders as prose ([StatelessUnowned]).
	Unowned []StatelessUnowned `json:"unowned"`

	// Adoptable is every live resource the estate-wide sweep matched to a
	// declared instance BY CONTENT - the identity-bearing arguments agree
	// exactly, and the object carries no marker for this estate - the
	// same rows the human-readable "Adoptable" section renders
	// ([StatelessBindCandidate]). GitHub issue #962: a declared aws_vpc
	// whose identity the server assigns lands in Omissions as
	// NEEDS_DISCOVERY, and until this field existed the document had no
	// row for the live VPC the sweep had already matched to it, while the
	// -adoption-only human render did. The two sections are disjoint on
	// purpose: Unowned is a live object read at an identity the
	// configuration DECLARES; Adoptable is one the sweep FOUND for a
	// declaration that declares no identity at all.
	//
	// Empty on any run that did not ask the account-inventory question
	// (an ordinary plan without TOFU_LIVE_COLLECT_UNCLAIMED, see
	// collectUnclaimedSetting), which is why Swept below travels with it.
	Adoptable []LivePlanAdoptable `json:"adoptable"`

	// Swept is every resource type the estate-wide sweep listed in full
	// on this run - the same list the human-readable "Foreign resources"
	// section counts. A consumer reads an empty Adoptable against it: no
	// rows with the declared type in Swept means the sweep looked and
	// found no match; no rows with Swept empty means this run did not
	// look, and "choudoufu plan -adoption-only" or
	// TOFU_LIVE_COLLECT_UNCLAIMED=1 is how to ask.
	Swept []string `json:"swept"`

	// Diagnostics is every warning and error this run raised outside the
	// three sections above - a state file present but not consulted, a
	// provider version skew warning, and so on. It exists so that -json
	// can be the ONLY thing printed on a successful run without silently
	// dropping something [Run] would otherwise have told a human: see
	// [StatelessPlanJSON.Document]'s own caller
	// (LivePlanCommand.livePlan's jsonRequested branch) for why the
	// ordinary human-readable diagnostic rendering is skipped precisely
	// when this document exists to carry the same information instead.
	// Empty on the common run: most of this fork's own findings already
	// have a home in Omissions or Unowned above and never reach a bare
	// diagnostic at all.
	Diagnostics []LivePlanDiagnostic `json:"diagnostics,omitempty"`
}

LivePlanDocument is live-plan -json's own structured snapshot (GitHub issue #788): the three live sections a stock plan's "-json" has no notion of at all, plus enough of a header that a reader can tell what produced it. The concrete consumer the issue names, behold (github.com/INTENTIUS/behold), reads exactly this: bound is the green paint, unowned is the amber, omissions is the blue, and anything this document does not cover is the "did not look" it renders honestly rather than guessing at.

Deliberately NOT the stock plan-representation JSON format ("choudoufu show -json" of a saved plan, internal/command/jsonplan): this command refuses -out (statelessRejections, live_mode.go) and so never has a saved plan to represent that way, and the issue's own text says as much - "the stock plan's -json...can stay separate. This is about the live sections that stock has no equivalent of." This document is printed on its own by StatelessPlanJSON.Document, the same way [VersionMixed.printJsonVersion] prints the version command's own single JSON object rather than a line of NewJSONView's general UI-message stream - see that method's own doc comment for why mixing the two protocols on one stdout would serve neither.

type LivePlanMatchedArgument added in v0.15.0

type LivePlanMatchedArgument struct {
	Attribute string `json:"attribute"`
	Value     string `json:"value"`
}

LivePlanMatchedArgument is one argument a content match rested on.

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 NewAdoptionOnlyPlan added in v0.5.0

func NewAdoptionOnlyPlan(inner Plan, view *View) Plan

NewAdoptionOnlyPlan wraps inner. view is the base view the compact warning list is written through, the same one the ledger itself uses.

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 StatelessAdoption added in v0.5.0

type StatelessAdoption struct {
	// Estate is the estate name this run looked for markers of, empty when
	// the run could not settle one.
	Estate string

	// Rows is every declared instance the projection attempted, in address
	// order.
	Rows []StatelessAdoptionRow

	// Swept is whether a discovery sweep ran at all. Without one, nothing
	// here says whether an unmarked live resource exists to be adopted, and
	// the view says so rather than letting an empty ADOPTABLE list read as
	// "there is nothing to adopt".
	Swept bool
}

StatelessAdoption is the whole adoption question for one run.

func (StatelessAdoption) Empty added in v0.5.0

func (a StatelessAdoption) Empty() bool

Empty reports whether there is nothing to render.

type StatelessAdoptionClass added in v0.5.0

type StatelessAdoptionClass string

StatelessAdoptionClass is what this run found for one declared instance, on the one question this view asks. Every declared instance the projection attempted gets exactly one.

const (
	// AdoptionMarked is a live resource this estate's marker is already on.
	// Nothing to do; it is already this estate's.
	AdoptionMarked StatelessAdoptionClass = "MARKED"

	// AdoptionAdoptable is a live resource a marker write would bind, with
	// the values to write (and, where the type has one, a paste-ready
	// command) in hand.
	AdoptionAdoptable StatelessAdoptionClass = "ADOPTABLE"

	// AdoptionNoPath is the gap MIGRATION.md found: the instance needs a
	// marker to ever be found again, and this run has no live resource to
	// offer for it. Something may well be live; this run cannot say which
	// object it is, so it cannot print a command.
	AdoptionNoPath StatelessAdoptionClass = "NO_PATH"

	// AdoptionInTheWay is a live resource at the declared identity that this
	// run may not claim - another estate holds it, or this run has no estate
	// name to write.
	AdoptionInTheWay StatelessAdoptionClass = "IN_THE_WAY"

	// AdoptionAbsent means nothing live was found at the instance's
	// identity. There is nothing to adopt, which is not a problem: the plan
	// creates it.
	AdoptionAbsent StatelessAdoptionClass = "ABSENT"

	// AdoptionWaitsOnParent means the instance's identity is a formula over
	// a parent's live identity and the parent is not resolved yet. Adopting
	// the parent resolves this one for free; there is no separate action
	// here, and never a marker.
	AdoptionWaitsOnParent StatelessAdoptionClass = "WAITS_ON_PARENT"

	// AdoptionUnreadable is everything else the projection could not read -
	// a provider error, a cycle. Reported so the ledger's counts add up to
	// the declared population rather than quietly losing rows.
	AdoptionUnreadable StatelessAdoptionClass = "UNREADABLE"
)

type StatelessAdoptionHuman added in v0.5.0

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

StatelessAdoptionHuman renders only the adoption ledger.

func (*StatelessAdoptionHuman) Adoption added in v0.5.0

func (v *StatelessAdoptionHuman) Adoption(rep StatelessAdoption)

Adoption renders the adoption ledger. It is a no-op on the ordinary stateless plan view, which renders its sections as they arrive; this implementation renders this section and nothing else, which is what "-adoption-only" means.

func (*StatelessAdoptionHuman) Document added in v0.12.0

Document renders nothing here either: GitHub issue #788's document and issue #587's adoption ledger are two different reports over the same run, and LivePlanCommand.Run refuses the two flags together rather than picking one silently (live_plan.go's own jsonRequested-and-AdoptionOnly check) - so this method exists only to satisfy StatelessPlan and is never actually reached with anything to print.

func (*StatelessAdoptionHuman) Foreign added in v0.5.0

func (*StatelessAdoptionHuman) GuidedFallback added in v0.5.0

func (v *StatelessAdoptionHuman) GuidedFallback(string)

func (*StatelessAdoptionHuman) Lookalikes added in v0.5.0

func (v *StatelessAdoptionHuman) Lookalikes([]StatelessLookalike)

func (*StatelessAdoptionHuman) Omissions added in v0.5.0

func (v *StatelessAdoptionHuman) Omissions([]StatelessOmission)

func (*StatelessAdoptionHuman) Policy added in v0.5.0

func (*StatelessAdoptionHuman) Progress added in v0.5.0

Progress passes through: it writes to stderr, never to the report.

func (*StatelessAdoptionHuman) Unowned added in v0.5.0

type StatelessAdoptionRow added in v0.5.0

type StatelessAdoptionRow struct {
	// Addr is the declared instance address.
	Addr string

	// TypeName is its resource type.
	TypeName string

	// Class is what this run found. Exactly one per row.
	Class StatelessAdoptionClass

	// CanCarryMarker is whether the provider's schema for TypeName has a
	// tags argument of the shape live/MARKERS.md describes - markers.Taggable
	// over the schema this run's own provider served, the same predicate
	// live-import's UNTAGGABLE verdict is. False is not a defect and not a
	// gap: an untaggable resource is identified by its own declaration and
	// its parents' identities, so no marker is ever written onto it and
	// there is nothing to adopt.
	CanCarryMarker bool

	// LiveID is the identity of the live resource this row is about, when
	// one was found.
	LiveID string

	// DisplayName is a human-friendlier name for the same object, when the
	// type has one distinct from LiveID.
	DisplayName string

	// Matched is what a content match was made on, for an ADOPTABLE row that
	// came from the foreign classifier rather than from a declared
	// identity's own read.
	Matched []StatelessTag

	// MarkerEstate and MarkerAddress are the tofu-estate and tofu-address
	// values that adopt the resource. Set only on ADOPTABLE rows.
	MarkerEstate  string
	MarkerAddress string

	// Hint is a paste-ready command that writes both markers, when the type
	// has one. Empty for a type whose tagging call this fork does not print
	// (IAM and Route53 both have their own), which is not the same as the
	// resource being unadoptable - MarkerEstate and MarkerAddress still say
	// exactly what to write.
	Hint string

	// HeldBy is the estate that holds an IN_THE_WAY resource, empty when the
	// obstacle is that this run has no estate name of its own.
	HeldBy string

	// Detail is the sentence the underlying stage wrote about this instance,
	// carried through verbatim rather than reworded: for NO_PATH and
	// UNREADABLE rows it is the projection's own omission detail, which is
	// the only place the reason is stated.
	Detail string
}

StatelessAdoptionRow is one declared resource instance's answer.

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

	// NativeSweepSkipped is how many admitted types the estate-wide
	// sweep's native per-type leg did not list, because this run did not
	// ask the account-inventory question and this estate's own record
	// store gave a narrower universe to sweep
	// ([discovery.Result.NativeSweepSkipped],
	// the stale-state ruling (#604)). Zero on any run that asked -
	// -adoption-only, or TOFU_LIVE_COLLECT_UNCLAIMED - and on any run with
	// no record store to narrow by.
	//
	// It is rendered rather than kept internal because the difference
	// between "we looked and there is nothing" and "we did not look" is
	// the whole content of this section, and a narrowed run has done less
	// looking than the wording alone implies.
	NativeSweepSkipped int

	// 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. See NewStatelessMvJSON for -json's own, which live-mv's Run calls instead of this one rather than through it: the two reports diverge (a refusal is worth a JSON document too, which StatelessMvHuman never renders one for), so there is no single call site that decides between them by swapping this function's return value alone.

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 StatelessMvJSON added in v0.12.0

type StatelessMvJSON interface {
	Report(rep StatelessMvJSONReport)
}

StatelessMvJSON renders the -json report: exactly one document, on both a completed move and a refused one, which is what makes it usable as a preview (the workbench, over -dry-run) and as a receipt (the smoke's own carve-by-retag assertion, comparing a dry run's document against a real run's) alike - StatelessMv's human report only ever renders a success.

func NewStatelessMvJSON added in v0.12.0

func NewStatelessMvJSON(view *View) StatelessMvJSON

NewStatelessMvJSON returns the JSON implementation of the -json report.

type StatelessMvJSONEndpoint added in v0.12.0

type StatelessMvJSONEndpoint struct {
	Estate  string `json:"estate,omitempty"`
	Address string `json:"address"`
	Marker  string `json:"marker,omitempty"`
}

StatelessMvJSONEndpoint is one side of a move: the address as an operator would type it, unescaped, and the estate and escaped tag value that address means as a marker.

type StatelessMvJSONFollower added in v0.12.0

type StatelessMvJSONFollower struct {
	Address  string `json:"address"`
	TypeName string `json:"type"`
}

StatelessMvJSONFollower is one instance that follows Resource with no write of its own - see mv.Result.Followers and mv.Follower's own doc comments for what "follows" means here.

type StatelessMvJSONHuman added in v0.12.0

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

StatelessMvJSONHuman is named to match StatelessMvHuman - "human" here means "the process talking to a human's terminal or a script's pipe", View's own streams, the same meaning StatelessMvHuman gives it, not a claim about the output being prose. There is exactly one JSON rendering; this is it.

func (*StatelessMvJSONHuman) Report added in v0.12.0

type StatelessMvJSONRefusal added in v0.12.0

type StatelessMvJSONRefusal struct {
	Code    string `json:"code,omitempty"`
	Summary string `json:"summary"`
	Detail  string `json:"detail"`
}

StatelessMvJSONRefusal is the "reason as a stable code plus the text" the Ask names: Code is empty for a refusal outside the five [mv.RefusalCode] shapes, and Summary/Detail are the same two halves StatelessMvHuman's underlying diagnostic would otherwise only reach a reader as formatted prose on stderr.

type StatelessMvJSONReport added in v0.12.0

type StatelessMvJSONReport struct {
	// Resource is the live object: its type and its import identity - an
	// ARN for the types that have one, the provider's own identity string
	// otherwise.
	Resource StatelessMvJSONResource `json:"resource"`

	// From and To are the address on each side of the move: the unescaped
	// address an operator would type, the estate it belongs to, and the
	// escaped tofu-address value that names it as a tag. From's Estate is
	// the source estate for a cross-estate move (Request.FromEstate) and
	// the same estate as To's otherwise - a rename never leaves the address
	// without an estate to be found under.
	From StatelessMvJSONEndpoint `json:"from"`
	To   StatelessMvJSONEndpoint `json:"to"`

	// Followers are the declared instances that move along with Resource
	// without a marker write of their own - mv.Result.Followers, unpacked
	// into the two facts a reader needs to draw them moving too. Omitted
	// entirely, not printed as [], when Resource has none: the zero value a
	// reader gets by leaving out a JSON key it never asked about.
	Followers []StatelessMvJSONFollower `json:"followers,omitempty"`

	// DryRun echoes -dry-run: true means nothing below was written, whether
	// or not Refusal is set - a dry run still refuses exactly what a real
	// run would have.
	DryRun bool `json:"dry_run"`

	// Written is true once ApplyResourceChange completed - never true
	// alongside DryRun, and never true alongside Refusal.
	Written bool `json:"written"`

	// Verified is true when the object the provider returned from the apply
	// was read back carrying the new marker - mv.Result.Verified's own doc
	// comment names the providers that do not serve tags back on that read,
	// which is why this can be false on a write that still succeeded. This
	// is literally the answer to the Why section's "what proved it": Written
	// says the apply returned no error, Verified says the marker was seen.
	Verified bool `json:"verified"`

	// FoundBy is mv.Path's own stable value - "LIST" or "IDENTITY" - naming
	// which admission rule located the live resource. Empty when nothing was
	// found at all (a refusal before Move ever got there).
	FoundBy string `json:"found_by,omitempty"`

	// RequestID would be whatever the provider's own write returned that a
	// CloudTrail row could be matched on - the Why section's "so the receipt
	// phase's join is by id rather than by time window". It is always empty
	// today: the plugin protocol's ApplyResourceChangeResponse
	// (internal/providers/provider.go) carries NewState, Private and
	// NewIdentity and nothing resembling a wire-level request id, and no
	// provider this repository talks to surfaces one through any other RPC
	// either. Threading one through would mean widening the provider
	// protocol itself - a protobuf and SDK change reaching past this
	// repository into the providers it drives, which is a different piece
	// of work than this issue's field, so the field is kept, empty and
	// documented, rather than dropped: a future protocol change has
	// somewhere to land its value without another round of API design.
	RequestID string `json:"request_id,omitempty"`

	// Refusal is set whenever this run did not complete - present with an
	// empty Code for a refusal outside the five stable shapes [mv.RefusalCode]
	// names (a malformed marker, a provider error, an argument problem
	// raised before Move ever ran), and nil on an ordinary success.
	Refusal *StatelessMvJSONRefusal `json:"refusal,omitempty"`
}

StatelessMvJSONReport is one live-mv move, or one refusal, as the single document -json prints instead of StatelessMvReport's labelled rows.

It exists so that anything reconstructing a move from live-mv's output - the workbench's preview phase, which used to re-derive the map from the text a -dry-run printed (examples/live-mv-workbench/README.md, "The projection is the page's arithmetic over the dry-run reports"), or behold, which never writes to a cloud and would render carve.json's plan as cards gliding between estate boxes and then read this document to confirm what a human ran - has one parse target instead of a prose reconstruction. See the issue's "Ask" for the field-by-field reasoning; this struct is that list, not a superset invented for convenience.

type StatelessMvJSONResource added in v0.12.0

type StatelessMvJSONResource struct {
	TypeName    string `json:"type"`
	LiveID      string `json:"live_id"`
	DisplayName string `json:"display_name,omitempty"`
}

StatelessMvJSONResource is the "the resource: ARN or identity, type" half of the Ask, plus DisplayName where the list path supplied one - the same three facts StatelessMvReport already carries as TypeName/LiveID/ DisplayName, renamed to what a JSON reader expects them called.

type StatelessMvReport

type StatelessMvReport struct {
	// Estate is the estate the rename happened within - the destination, for
	// a cross-estate move.
	Estate string

	// FromEstate is the estate the resource left, for a cross-estate move,
	// and empty for a rename.
	FromEstate 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 `json:"addr"`
	Reason string `json:"reason"`
	Detail string `json:"detail"`
}

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.

The json tags are GitHub issue #788's: LivePlanDocument's own "omissions[]" marshals this struct directly rather than through a mirror type, per the issue's own text ("marshal these same structs...rather than re-deriving the data") - it was already exactly the JSON-ready shape the issue asks for, just without tags naming the keys.

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)

	// Adoption reports the whole adoption question - what can be adopted,
	// what cannot, and why - for GitHub issue #587's "-adoption-only" mode.
	// The pipeline calls it on every stateless run; only
	// [StatelessAdoptionHuman] renders it, and that view renders nothing
	// else. See live_adoption.go.
	Adoption(rep StatelessAdoption)

	// Document prints GitHub issue #788's live-plan "-json" output: one
	// object carrying the estate name, this fork's and OpenTofu's own
	// versions, and the bound/omissions/unowned sections as data instead
	// of prose - see [LivePlanDocument]'s own doc comment for the whole
	// shape and for why it does not reuse the fields above verbatim even
	// though two of them (Omissions, Unowned) already carry exactly this
	// data.
	//
	// Every implementation but [StatelessPlanJSON] no-ops here: a human or
	// adoption-ledger run has nothing to marshal and nowhere in its own
	// output this document would belong. It returns whether the print
	// succeeded, the same convention [Version.PrintVersion] uses for the
	// version command's own bespoke JSON output - the one other command in
	// this package whose "-json" is a single marshaled object rather than
	// a line in [NewJSONView]'s general UI-message stream.
	Document(doc LivePlanDocument) bool
}

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 NewStatelessAdoption added in v0.5.0

func NewStatelessAdoption(view *View) StatelessPlan

NewStatelessAdoption returns the "-adoption-only" implementation of StatelessPlan: it renders the adoption ledger and nothing else.

It is a second implementation of the VIEW, never of the judgement. Every other method is a deliberate no-op, so the pipeline calls the same methods in the same order either way and the sections this mode drops are dropped in one place rather than by threading a flag through the run. Progress is the one exception, kept because a heartbeat goes to stderr and proves a slow sweep is still running - the same reason the ordinary view treats it differently.

func NewStatelessPlan

func NewStatelessPlan(view *View) StatelessPlan

NewStatelessPlan returns the human-readable implementation. GitHub issue #788's document (LivePlanCommand.livePlan's own jsonRequested branch) uses NewStatelessPlanJSON instead; this constructor's own Document method is a no-op, since nothing about a human-readable run ever calls it.

func NewStatelessPlanJSON added in v0.12.0

func NewStatelessPlanJSON(view *View) StatelessPlan

NewStatelessPlanJSON returns live-plan -json's own renderer (GitHub issue #788). Every method but Document is a no-op: the prose those other methods print (Progress's heartbeat, Foreign, Policy, GuidedFallback, Lookalikes, and Omissions/Unowned themselves - their DATA reaches a reader through the one document instead) has no place beside a machine-readable run, and printing some of it as text next to a JSON document would leave stdout neither one thing nor the other - the same reasoning [LivePlanCommand.livePlan]'s own jsonRequested doc comment gives for skipping the ordinary resource-diff rendering too. A caller that wants foreign/policy/lookalike detail as data does not have it from this command yet; #788's own Ask is bound/omissions/unowned, and that is everything Document carries.

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) Adoption added in v0.5.0

Adoption renders nothing on the ordinary plan view. The adoption ledger is a whole-run summary of what the sections above already say instance by instance, so printing it here as well would restate the same verdicts a second time in a report GitHub issue #587 exists because it is already too long. StatelessAdoptionHuman is the view that renders it, and it renders nothing else.

func (*StatelessPlanHuman) Document added in v0.12.0

Document renders nothing here: GitHub issue #788's document is StatelessPlanJSON's own output, printed instead of a human-readable run's prose sections rather than beside them - see [LivePlanCommand.livePlan]'s jsonRequested branch, which is the only caller of this method and never holds a *StatelessPlanHuman when it calls it.

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 StatelessPlanJSON added in v0.12.0

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

StatelessPlanJSON marshals and prints LivePlanDocument as one indented JSON object, the same way [VersionMixed.printJsonVersion] prints the version command's own single object - not through NewJSONView's hclog-based UI-message stream every OTHER "-json" view in this package writes through. That stream's envelope (one line per message, each tagged with a "type" - a resource diff, a diagnostic, a hook) has no slot this document fits without inventing a new message type for a document that is not a stream of anything; printing it directly, once, is both simpler and matches what a renderer reading exactly this document (behold, the issue's own named consumer) actually wants: one parse, one object, done.

func (*StatelessPlanJSON) Adoption added in v0.12.0

func (v *StatelessPlanJSON) Adoption(StatelessAdoption)

func (*StatelessPlanJSON) Document added in v0.12.0

func (v *StatelessPlanJSON) Document(doc LivePlanDocument) bool

Document is this view's whole reason to exist: marshal doc and print it, exactly once. Modeled on [VersionMixed.printJsonVersion] down to the indent and the error handling - a marshal failure here would mean a field in LivePlanDocument cannot round-trip through encoding/json at all (every field is a plain string, map or slice of one of these structs; there is no channel, func or cyclic pointer anywhere in this type for MarshalIndent to choke on), so this is defensive rather than an expected failure mode.

func (*StatelessPlanJSON) Foreign added in v0.12.0

func (v *StatelessPlanJSON) Foreign(StatelessForeign)

func (*StatelessPlanJSON) GuidedFallback added in v0.12.0

func (v *StatelessPlanJSON) GuidedFallback(string)

func (*StatelessPlanJSON) Lookalikes added in v0.12.0

func (v *StatelessPlanJSON) Lookalikes([]StatelessLookalike)

func (*StatelessPlanJSON) Omissions added in v0.12.0

func (v *StatelessPlanJSON) Omissions([]StatelessOmission)

func (*StatelessPlanJSON) Policy added in v0.12.0

func (*StatelessPlanJSON) Progress added in v0.12.0

func (v *StatelessPlanJSON) Progress(StatelessProgress)

func (*StatelessPlanJSON) Unowned added in v0.12.0

func (v *StatelessPlanJSON) Unowned([]StatelessUnowned)

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 `json:"addr"`

	// 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 `json:"type"`
	LiveID   string `json:"identity"`

	// 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 `json:"tofu_estate,omitempty"`

	// 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 `json:"adopt_tofu_estate,omitempty"`
	MarkerAddress string `json:"adopt_tofu_address,omitempty"`
}

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.

The json tags are GitHub issue #788's "unowned[]": Addr, TypeName and LiveID are the declared address, the type and "the identity" the Ask names; HeldBy is "the tofu-estate...it does carry (if any)"; MarkerEstate and MarkerAddress together are "the exact tag write that would adopt it". There is deliberately no field for a carried tofu-address: unlike tofu-estate, nothing upstream of this struct (projection.Unowned, internal/live/projection/ownership.go) reads or keeps whatever tofu-address tag the live object happens to carry - the check that produces an Unowned entry only ever asks "does this carry OUR marker", never "what does its own tofu-address say" - so there is no value here to marshal honestly. Adding one would mean teaching the ownership check itself a new read, which is out of this issue's own file scope (live_plan.go, live_plan_test.go, this file) and a bigger change than a JSON tag.

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) DiagnosticsToStderr added in v0.12.0

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

DiagnosticsToStderr is View.Diagnostics with one difference: every diagnostic goes to Stderr, warnings included, rather than splitting warnings onto Stdout. It exists for a command whose successful Stdout is a single machine-parsed document - choudoufu live-mv -json (GitHub issue #791) is the first caller - where a warning landing on Stdout by Diagnostics' ordinary rule would interleave human prose into that document. Formatting is identical; only the stream changes, and unlike Diagnostics this ignores whatever View.DiagsWithNewline configured, because that configuration is itself a per-severity stream split of the same kind this method exists to turn off.

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.

func (*View) StdoutOnStderr added in v0.14.0

func (v *View) StdoutOnStderr() *View

StdoutOnStderr returns a copy of this view whose Stdout stream IS its Stderr stream, so that everything built over the copy - a plan view's resource diff, the per-instance lines UiHook prints while the plan graph walks, warning diagnostics - lands on Stderr instead of interleaving with a machine-readable document another view is printing to the real Stdout.

GitHub issue #894's second half. "choudoufu live-plan -json" prints one LivePlanDocument and nothing else, but the plan it runs still drives UiHook, whose lines go through streams.Stdout unconditionally (hook_ui.go's println). A configuration with a data source therefore printed

data.aws_caller_identity.current: Reading...
data.aws_caller_identity.current: Read complete after 0s [id=...]

ahead of the document, and a consumer piping stdout straight into a JSON parser got "jq: parse error: Invalid numeric literal at line 1, column 33" (reproduced against a live emulator, 2026-09-06). Redirecting the stream the hooks were built over fixes that at the one place both halves already agree on - the view - rather than teaching every hook a second stream it would have to be told about again next time one is added.

The copy shares Stdin and every other setting; only the streams change. View.DiagnosticsToStderr is the narrower tool for the same problem where diagnostics alone are at stake.

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