Documentation
¶
Index ¶
- Constants
- Variables
- func CommandUsage(namespace string, cmd Command, w io.Writer)
- func RunCli(namespace string, cmd Command, meta Meta, diags tfdiags.Diagnostics) int
- type ApplyCommand
- func (c ApplyCommand) Execute(args *arguments.Apply, view views.Apply) int
- func (c *ApplyCommand) LoadPlanFile(path string, enc encryption.Encryption) (*planfile.WrappedPlanFile, tfdiags.Diagnostics)
- func (c *ApplyCommand) OperationRequest(ctx context.Context, be backend.Enhanced, view views.Apply, ...) (*backend.Operation, tfdiags.Diagnostics)
- func (c *ApplyCommand) PrepareBackend(ctx context.Context, planFile *planfile.WrappedPlanFile, args *arguments.State, ...) (backend.Enhanced, tfdiags.Diagnostics)
- type BackendOpts
- type BackendWithRemoteTerraformVersion
- type Command
- func AdoptCommander() Command
- func ApplyCommander() Command
- func BootstrapCommander() Command
- func CICommander() Command
- func ConsoleCommander() Command
- func DestroyCommander() Command
- func DoctorCommander() Command
- func FmtCommander(input io.Reader) Command
- func GetCommander() Command
- func GraphCommander() Command
- func ImportCommander() Command
- func InitCommander() Command
- func LoginCommander() Command
- func LogoutCommander() Command
- func MetadataCommander() Command
- func MetadataFunctionsCommander() Command
- func MigrateCommander() Command
- func MigrateTFCCommander() Command
- func OutputCommander() Command
- func PlanCommander() Command
- func ProvidersCommander() Command
- func ProvidersLockCommander() Command
- func ProvidersMirrorCommander() Command
- func ProvidersSchemaCommander() Command
- func RefreshCommander() Command
- func RootCommander(help *bool, ver *bool, chdir *string) Command
- func ShowCommander() Command
- func StateCommander() Command
- func StateHistoryCommander() Command
- func StateListCommander() Command
- func StateMvCommander() Command
- func StatePassphraseCommander() Command
- func StatePullCommander() Command
- func StatePushCommander() Command
- func StateRekeyCommander() Command
- func StateReplaceProviderCommander() Command
- func StateRestoreCommander() Command
- func StateRmCommander() Command
- func StateShowCommander() Command
- func TaintCommander() Command
- func TestCommander() Command
- func UICommander() Command
- func UnlockCommander() Command
- func UntaintCommander() Command
- func ValidateCommander() Command
- func VersionCommander(version string, versionPrerelease string, platform getproviders.Platform) Command
- func WorkspaceCommander(legacyName bool) Command
- func WorkspaceDeleteCommander(legacyName bool) Command
- func WorkspaceListCommander(legacyName bool) Command
- func WorkspaceNewCommander(legacyName bool) Command
- func WorkspaceSelectCommander(legacyName bool) Command
- func WorkspaceShowCommander() Command
- type ConsoleCommand
- type FmtCommand
- type GetCommand
- type GraphCommand
- type Group
- type ImportCommand
- type InitCommand
- type LoginCommand
- type LogoutCommand
- type Meta
- func (m *Meta) Backend(ctx context.Context, opts *BackendOpts, enc encryption.StateEncryption) (backend.Enhanced, tfdiags.Diagnostics)
- func (m *Meta) BackendForLocalPlan(ctx context.Context, settings plans.Backend, enc encryption.StateEncryption) (backend.Enhanced, tfdiags.Diagnostics)
- func (m *Meta) CommandContext() context.Context
- func (m *Meta) Encryption(ctx context.Context) (encryption.Encryption, tfdiags.Diagnostics)
- func (m *Meta) EncryptionFromModule(ctx context.Context, module *configs.Module) (encryption.Encryption, tfdiags.Diagnostics)
- func (m *Meta) EncryptionFromPath(ctx context.Context, path string) (encryption.Encryption, tfdiags.Diagnostics)
- func (m *Meta) Input() bool
- func (m *Meta) InputMode() tofu.InputMode
- func (m *Meta) InterruptibleContext(base context.Context) (context.Context, context.CancelFunc)
- func (m *Meta) MaybeGetSchemas(ctx context.Context, state *states.State, config *configs.Config) (*tofu.Schemas, tfdiags.Diagnostics)
- func (m *Meta) NewRuntimeEnabled() bool
- func (m *Meta) Operation(ctx context.Context, b backend.Backend, view views.Backend, ...) *backend.Operation
- func (m *Meta) PlanFile(path string, enc encryption.PlanEncryption) (*planfile.WrappedPlanFile, error)
- func (m *Meta) RunOperation(ctx context.Context, b backend.Enhanced, opReq *backend.Operation) (*backend.RunningOperation, tfdiags.Diagnostics)
- func (m *Meta) SetWorkspace(name string) error
- func (m *Meta) StateOutPath() string
- func (m *Meta) StaticConfigInstance(ctx context.Context, root *configs.Module, modules eval.ExternalModules) (*eval.ConfigInstance, tfdiags.Diagnostics)
- func (m *Meta) UIInput() tofu.UIInput
- func (m *Meta) Workspace(ctx context.Context) (string, error)
- func (m *Meta) WorkspaceOverridden(_ context.Context) (string, bool)
- type MigrateTFCCommand
- type OutputCommand
- type PlanCommand
- func (c PlanCommand) Execute(args *arguments.Plan, view views.Plan) int
- func (c *PlanCommand) OperationRequest(ctx context.Context, be backend.Enhanced, view views.Plan, ...) (*backend.Operation, tfdiags.Diagnostics)
- func (c *PlanCommand) PrepareBackend(ctx context.Context, args *arguments.State, view views.Plan, ...) (backend.Enhanced, tfdiags.Diagnostics)
- type ProvidersCommand
- type ProvidersLockCommand
- type ProvidersMirrorCommand
- type ProvidersSchemaCommand
- type PushCommand
- type RefreshCommand
- func (c RefreshCommand) Execute(args *arguments.Refresh, view views.Refresh) int
- func (c *RefreshCommand) OperationRequest(ctx context.Context, be backend.Enhanced, view views.Refresh, ...) (*backend.Operation, tfdiags.Diagnostics)
- func (c *RefreshCommand) PrepareBackend(ctx context.Context, args *arguments.State, view views.Refresh, ...) (backend.Enhanced, tfdiags.Diagnostics)
- type ShowCommand
- type StateCommand
- type StateHistoryCommand
- type StateListCommand
- type StateMeta
- type StateMvCommand
- type StatePullCommand
- type StatePushCommand
- type StateRekeyCommand
- type StateReplaceProviderCommand
- type StateRestoreCommand
- type StateRmCommand
- type StateShowCommand
- type TaintCommand
- type TestCommand
- type TestFileRunner
- func (runner *TestFileRunner) Cleanup(ctx context.Context, file *moduletest.File)
- func (runner *TestFileRunner) ExecuteTestFile(ctx context.Context, file *moduletest.File)
- func (runner *TestFileRunner) ExecuteTestRun(ctx context.Context, run *moduletest.Run, file *moduletest.File, ...) (*states.State, bool)
- type TestFileState
- type TestSuiteRunner
- type UIInput
- type UnlockCommand
- type UntaintCommand
- type UsageOverride
- type ValidateCommand
- type VersionCommand
- type WorkspaceDeleteCommand
- type WorkspaceListCommand
- type WorkspaceNewCommand
- type WorkspaceSelectCommand
- type WorkspaceShowCommand
Constants ¶
const DefaultBackupExtension = ".backup"
DefaultBackupExtension is added to the state file to form the path
const DefaultParallelism = 10
DefaultParallelism is the limit Terraform places on total parallel operations as it walks the dependency graph.
const DefaultPluginVendorDir = "terraform.d/plugins/" + pluginMachineName
DefaultPluginVendorDir is the location in the config directory to look for user-added plugin binaries. Bogform only reads from this path if it exists, it is never created by tofu.
const DefaultVarsExtension = ".tfvars"
DefaultVarsExtension is the default file extension used for vars
const DefaultVarsFilename = "terraform" + DefaultVarsExtension
DefaultVarsFilename is the default filename used for vars
const ErrUnsupportedLocalOp = `` /* 286-byte string literal not displayed */
ErrUnsupportedLocalOp is the common error message shown for operations that require a backend.Local.
const ( // InputModeEnvVar is the environment variable that, if set to "false" or // "0", causes tofu commands to behave as if the `-input=false` flag was // specified. InputModeEnvVar = "TF_INPUT" )
const (
MainStateIdentifier = ""
)
const PluginPathFile = "plugin_path"
PluginPathFile is the name of the file in the data dir which stores the list of directories supplied by the user with the `-plugin-dir` flag during init.
const VarEnvPrefix = "TF_VAR_"
VarEnvPrefix is the prefix for environment variables that represent values for root module input variables.
const WorkspaceNameEnvVar = "TF_WORKSPACE"
WorkspaceNameEnvVar is the name of the environment variable that can be used to set the name of the Bogform workspace, overriding the workspace chosen by `bogform workspace select`.
Note that this environment variable is ignored by `bogform workspace new` and `bogform workspace delete`.
Variables ¶
var ( MainCommandGroup = Group{ID: "main", Title: "Main commands:", NoSort: true} OtherCommandGroup = Group{ID: "", Title: "All other commands:"} )
var RunResultHelp = -18511
RunResultHelp is a specific exit code that implies that help text should be shown. This was inherited from mitchellh/cli in 1.14
Functions ¶
func CommandUsage ¶
CommandUsage writes usage/help text to the given writer. This function standardizes how we format usage/help text.
Types ¶
type ApplyCommand ¶
type ApplyCommand struct {
Meta
// If true, then this apply command will become the "destroy"
// command. It is just like apply but only processes a destroy.
Destroy bool
}
ApplyCommand is a Command implementation that applies a Bogform configuration and actually builds or changes infrastructure.
func (*ApplyCommand) LoadPlanFile ¶
func (c *ApplyCommand) LoadPlanFile(path string, enc encryption.Encryption) (*planfile.WrappedPlanFile, tfdiags.Diagnostics)
func (*ApplyCommand) OperationRequest ¶
func (c *ApplyCommand) OperationRequest( ctx context.Context, be backend.Enhanced, view views.Apply, applyArgs *arguments.Apply, planFile *planfile.WrappedPlanFile, enc encryption.Encryption, ) (*backend.Operation, tfdiags.Diagnostics)
func (*ApplyCommand) PrepareBackend ¶
func (c *ApplyCommand) PrepareBackend(ctx context.Context, planFile *planfile.WrappedPlanFile, args *arguments.State, backendView views.Backend, enc encryption.StateEncryption) (backend.Enhanced, tfdiags.Diagnostics)
type BackendOpts ¶
type BackendOpts struct {
// Config is a representation of the backend configuration block given in
// the root module, or nil if no such block is present.
Config *configs.Backend
// ConfigOverride is an hcl.Body that, if non-nil, will be used with
// configs.MergeBodies to override the type-specific backend configuration
// arguments in Config.
ConfigOverride hcl.Body
// Init should be set to true if initialization is allowed. If this is
// false, then any configuration that requires configuration will show
// an error asking the user to reinitialize.
Init bool
// ForceLocal will force a purely local backend, including state.
// You probably don't want to set this.
ForceLocal bool
// ViewOptions will set console output format for the
// initialization operation (JSON or human-readable).
View views.Backend
}
BackendOpts are the options used to initialize a backend.Backend.
type BackendWithRemoteTerraformVersion ¶
type BackendWithRemoteTerraformVersion interface {
IgnoreVersionConflict()
VerifyWorkspaceTerraformVersion(workspace string) tfdiags.Diagnostics
IsLocalOperations() bool
}
BackendWithRemoteTerraformVersion is a shared interface between the 'remote' and 'cloud' backends for simplified type checking when calling functions common to those particular backends.
type Command ¶
type Command struct {
Name string
Aliases []string
// Short is the text that accompanies it in the parent command's help text.
Short string
// Long is the full description that is printed as part of the command's help text.
Long string
// GroupID if set determines what group to show the command under in the parent command's help text.
GroupID string
// If this command should not be shown in the help text of the parent command.
Hidden bool
// Commands are the sub-commands of the current command.
Commands []Command
// Groups to split the sub Commands into
Groups []Group
// UsageOverride are custom overrides for special cases.
// Ideally we can retire this eventually as we unify the help/usage text.
UsageOverride UsageOverride
// CommandLine defines what flags and arguments are available to this command.
CommandLine arguments.CommandLine
// Run is the action that will be executed if this command is selected.
Run func(Meta) int
AutocompleteArgs func(Meta) func(nargs int) []string
// A legacy option that will be removed at some point
// This was introduced during the migration to proper
// diagnostic error printing during the meta-refactor
DiagsWithNewline bool
}
Command is the metadata and action associated with a command available to the CLI. This is eventually translated into a parsable/runnable CLI in cmd/bogform.
func ApplyCommander ¶
func ApplyCommander() Command
func BootstrapCommander ¶
func BootstrapCommander() Command
BootstrapCommander builds the "bootstrap" command, which writes the configuration that gives repository pipelines access to a cloud account.
func CICommander ¶
func CICommander() Command
CICommander builds the "ci" command, which runs Bogform from repository pipelines.
func ConsoleCommander ¶
func ConsoleCommander() Command
func DestroyCommander ¶
func DestroyCommander() Command
func DoctorCommander ¶
func DoctorCommander() Command
DoctorCommander builds the "doctor" command, which checks a configuration's repository setup.
func FmtCommander ¶
func GetCommander ¶
func GetCommander() Command
func GraphCommander ¶
func GraphCommander() Command
func ImportCommander ¶
func ImportCommander() Command
func InitCommander ¶
func InitCommander() Command
func LoginCommander ¶
func LoginCommander() Command
func LogoutCommander ¶
func LogoutCommander() Command
func MetadataCommander ¶
func MetadataCommander() Command
func MetadataFunctionsCommander ¶
func MetadataFunctionsCommander() Command
func MigrateCommander ¶
func MigrateCommander() Command
MigrateCommander builds the "migrate" command, which moves infrastructure from other tools.
func MigrateTFCCommander ¶
func MigrateTFCCommander() Command
MigrateTFCCommander builds the "migrate tfc" command.
func OutputCommander ¶
func OutputCommander() Command
func PlanCommander ¶
func PlanCommander() Command
func ProvidersCommander ¶
func ProvidersCommander() Command
func ProvidersLockCommander ¶
func ProvidersLockCommander() Command
func ProvidersMirrorCommander ¶
func ProvidersMirrorCommander() Command
func ProvidersSchemaCommander ¶
func ProvidersSchemaCommander() Command
func RefreshCommander ¶
func RefreshCommander() Command
func RootCommander ¶
RootCommander builds the standard tofu root command.
func ShowCommander ¶
func ShowCommander() Command
func StateCommander ¶
func StateCommander() Command
func StateHistoryCommander ¶
func StateHistoryCommander() Command
StateHistoryCommander builds the "state history" command.
func StateListCommander ¶
func StateListCommander() Command
func StateMvCommander ¶
func StateMvCommander() Command
func StatePassphraseCommander ¶
func StatePassphraseCommander() Command
StatePassphraseCommander builds the "state passphrase" commands, which manage passphrases in the OS keychain for the passphrase key provider.
func StatePullCommander ¶
func StatePullCommander() Command
func StatePushCommander ¶
func StatePushCommander() Command
func StateRekeyCommander ¶
func StateRekeyCommander() Command
StateRekeyCommander builds the "state rekey" command.
func StateReplaceProviderCommander ¶
func StateReplaceProviderCommander() Command
func StateRestoreCommander ¶
func StateRestoreCommander() Command
StateRestoreCommander builds the "state restore" command.
func StateRmCommander ¶
func StateRmCommander() Command
func StateShowCommander ¶
func StateShowCommander() Command
func TaintCommander ¶
func TaintCommander() Command
func TestCommander ¶
func TestCommander() Command
func UICommander ¶
func UICommander() Command
UICommander builds the "ui" command, which shows pipeline reports in a dashboard on this computer.
func UnlockCommander ¶
func UnlockCommander() Command
func UntaintCommander ¶
func UntaintCommander() Command
func ValidateCommander ¶
func ValidateCommander() Command
func VersionCommander ¶
func VersionCommander(version string, versionPrerelease string, platform getproviders.Platform) Command
func WorkspaceCommander ¶
func WorkspaceListCommander ¶
func WorkspaceNewCommander ¶
func WorkspaceShowCommander ¶
func WorkspaceShowCommander() Command
type ConsoleCommand ¶
type ConsoleCommand struct {
Meta
}
ConsoleCommand is a Command implementation that starts an interactive console that can be used to try expressions with the current config.
type FmtCommand ¶
type FmtCommand struct {
Meta
// contains filtered or unexported fields
}
FmtCommand is a Command implementation that rewrites Bogform config files to a canonical format and style.
type GetCommand ¶
type GetCommand struct {
Meta
}
GetCommand is a Command implementation that takes a Bogform configuration and downloads all the modules.
type GraphCommand ¶
type GraphCommand struct {
Meta
}
GraphCommand is a Command implementation that takes a Bogform configuration and outputs the dependency tree in graphical form.
type Group ¶
Group defines a command group and it's metadata In practice, this is only used for the special formatting in the root command
type ImportCommand ¶
type ImportCommand struct {
Meta
}
ImportCommand is a cli.Command implementation that imports resources into the Bogform state.
type InitCommand ¶
type InitCommand struct {
Meta
}
InitCommand is a Command implementation that takes a Terraform module and clones it to the working directory.
type LoginCommand ¶
type LoginCommand struct {
Meta
}
LoginCommand is a Command implementation that runs an interactive login flow for a remote service host. It then stashes credentials in a tfrc file in the user's home directory.
type LogoutCommand ¶
type LogoutCommand struct {
Meta
}
LogoutCommand is a Command implementation which removes stored credentials for a remote service host.
type Meta ¶
type Meta struct {
// WorkingDir is an object representing the "working directory" where we're
// running commands. In the normal case this literally refers to the
// working directory of the Bogform process, though this can take on
// a more symbolic meaning when the user has overridden default behavior
// to specify a different working directory or to override the special
// data directory where we'll persist settings that must survive between
// consecutive commands.
//
// We're currently gradually migrating the various bits of state that
// must persist between consecutive commands in a session to be encapsulated
// in here, but we're not there yet and so there are also some methods on
// Meta which directly read and modify paths inside the data directory.
WorkingDir *workdir.Dir
// SystemCfg holds the configuration attributes that are global for all
// the commands and are used by different parts of the system.
//SystemCfg system.Config
SystemCfg system.Config
View *views.View
// Services provides access to remote endpoint information for
// 'tofu-native' services running at a specific user-facing hostname.
Services *disco.Disco
// PluginCacheMayBreakDependencyLockFile is a temporary CLI configuration-based
// opt out for the behavior of only using the plugin cache dir if its
// contents match checksums recorded in the dependency lock file.
//
// This is an accommodation for those who currently essentially ignore the
// dependency lock file -- treating it only as transient working directory
// state -- and therefore don't care if the plugin cache dir causes the
// checksums inside to only be sufficient for the computer where Bogform
// is currently running.
//
// We intend to remove this exception again (making the CLI configuration
// setting a silent no-op) in future once we've improved the dependency
// lock file mechanism so that it's usable for everyone and there are no
// longer any compelling reasons for folks to not lock their dependencies.
PluginCacheMayBreakDependencyLockFile bool
// ProviderSource allows determining the available versions of a provider
// and determines where a distribution package for a particular
// provider version can be obtained.
ProviderSource getproviders.Source
// ModulePackageFetcher is the client to use when fetching module packages
// from remote locations. This object effectively represents the policy
// for how to fetch remote module packages, which is decided by the caller.
//
// Leaving this nil means that only local modules (using relative paths
// in the source address) are supported, which is only reasonable for
// unit testing.
ModulePackageFetcher *getmodules.PackageFetcher
// MakeRegistryHTTPClient is a function called each time a command needs
// an HTTP client that will be used to make requests to a module or
// provider registry.
//
// This is used by package main to deal with some operator-configurable
// settings for retries and timeouts. If this isn't set then a new client
// with reasonable defaults for tests will be used instead.
MakeRegistryHTTPClient func() *retryablehttp.Client
// BrowserLauncher is used by commands that need to open a URL in a
// web browser.
BrowserLauncher webbrowser.Launcher
// A context.Context provided by the caller -- typically "package main" --
// which might be carrying telemetry-related metadata and so should be
// used when creating downstream traces, etc.
//
// This isn't guaranteed to be set, so use [Meta.CommandContext] to
// safely create a context for the entire execution of a command, which
// will be connected to this parent context if it's present.
CallerContext context.Context
// When this channel is closed, the command will be cancelled.
ShutdownCh <-chan struct{}
// ProviderDevOverrides are providers where we ignore the lock file, the
// configured version constraints, and the local cache directory and just
// always use exactly the path specified. This is intended to allow
// provider developers to easily test local builds without worrying about
// what version number they might eventually be released as, or what
// checksums they have.
ProviderDevOverrides map[addrs.Provider]getproviders.PackageLocalDir
// UnmanagedProviders are a set of providers that exist as processes
// predating Bogform, which Bogform should use but not worry about the
// lifecycle of.
//
// This is essentially a more extreme version of ProviderDevOverrides where
// Bogform doesn't even worry about how the provider server gets launched,
// just trusting that someone else did it before running Bogform.
UnmanagedProviders map[addrs.Provider]*plugin.ReattachConfig
// Since `bogform providers lock` and `bogform providers mirror` have their own
// logic to create the source to fetch providers through, we had to
// plumb this configuration through the [Meta] type to reach that part too.
// In any other cases, this configuration is built and used directly in `realMain`
// when the providers sources are built.
ProviderSourceLocationConfig getproviders.LocationConfig
OCICredentialsPolicyBuilder oci.OCICredsPolicyBuilder
// contains filtered or unexported fields
}
Meta are the meta-options that are available on all or most commands.
func (*Meta) Backend ¶
func (m *Meta) Backend(ctx context.Context, opts *BackendOpts, enc encryption.StateEncryption) (backend.Enhanced, tfdiags.Diagnostics)
Backend initializes and returns the backend for this CLI session.
The backend is used to perform the actual Bogform operations. This abstraction enables easily sliding in new Bogform behavior such as remote state storage, remote operations, etc. while allowing the CLI to remain mostly identical.
This will initialize a new backend for each call, which can carry some overhead with it. Please reuse the returned value for optimal behavior.
Only one backend should be used per Meta. This function is stateful and is unsafe to create multiple backends used at once. This function can be called multiple times with each backend being "live" (usable) one at a time.
A side-effect of this method is the population of m.backendState, recording the final resolved backend configuration after dealing with overrides from the "bogform init" command line, etc.
func (*Meta) BackendForLocalPlan ¶
func (m *Meta) BackendForLocalPlan(ctx context.Context, settings plans.Backend, enc encryption.StateEncryption) (backend.Enhanced, tfdiags.Diagnostics)
BackendForLocalPlan is similar to Backend, but uses backend settings that were stored in a plan.
The current workspace name is also stored as part of the plan, and so this method will check that it matches the currently-selected workspace name and produce error diagnostics if not.
func (*Meta) CommandContext ¶
CommandContext returns the "root context" to use in the main Run function of a command.
If the caller (e.g. "package main") provided a context when it instantiated the Meta then the returned context will inherit all of its values, deadlines, etc. If the caller did not provide a context then the result is an inert background context ready to be passed to other functions.
func (*Meta) Encryption ¶
func (m *Meta) Encryption(ctx context.Context) (encryption.Encryption, tfdiags.Diagnostics)
func (*Meta) EncryptionFromModule ¶
func (m *Meta) EncryptionFromModule(ctx context.Context, module *configs.Module) (encryption.Encryption, tfdiags.Diagnostics)
func (*Meta) EncryptionFromPath ¶
func (m *Meta) EncryptionFromPath(ctx context.Context, path string) (encryption.Encryption, tfdiags.Diagnostics)
func (*Meta) InputMode ¶
InputMode returns the type of input we should ask for in the form of tofu.InputMode which is passed directly to Context.Input.
func (*Meta) InterruptibleContext ¶
InterruptibleContext returns a context.Context that will be cancelled if the process is interrupted by a platform-specific interrupt signal.
The typical way to use this is to pass the result of Meta.CommandContext as the base context, but that's appropriate only if the interruptible context is being created directly inside the "Run" method of a particular command, to create a context representing the entire remaining runtime of that command:
As usual with cancelable contexts, the caller must always call the given cancel function once all operations are complete in order to make sure that the context resources will still be freed even if there is no interruption.
// This example is only for when using this function very early in // the "Run" method of a Command implementation. If you already have // an active context, pass that in as base instead. ctx, done := c.InterruptibleContext(c.CommandContext()) defer done()
func (*Meta) MaybeGetSchemas ¶
func (m *Meta) MaybeGetSchemas(ctx context.Context, state *states.State, config *configs.Config) (*tofu.Schemas, tfdiags.Diagnostics)
MaybeGetSchemas attempts to load and return the schemas If there is not enough information to return the schemas, it could potentially return nil without errors. It is the responsibility of the caller to handle the lack of schema information accordingly
func (*Meta) NewRuntimeEnabled ¶
func (*Meta) Operation ¶
func (m *Meta) Operation(ctx context.Context, b backend.Backend, view views.Backend, enc encryption.Encryption) *backend.Operation
Operation initializes a new backend.Operation struct.
This prepares the operation. After calling this, the caller is expected to modify fields of the operation such as Sequence to specify what will be called.
func (*Meta) PlanFile ¶
func (m *Meta) PlanFile(path string, enc encryption.PlanEncryption) (*planfile.WrappedPlanFile, error)
PlanFile loads the plan file at the given path, which might be either a local or cloud plan.
If the return value and error are both nil, the given path exists but seems to be a configuration directory instead.
Error will be non-nil if path refers to something which looks like a plan file and loading the file fails.
func (*Meta) RunOperation ¶
func (m *Meta) RunOperation(ctx context.Context, b backend.Enhanced, opReq *backend.Operation) (*backend.RunningOperation, tfdiags.Diagnostics)
RunOperation executes the given operation on the given backend, blocking until that operation completes or is interrupted, and then returns the RunningOperation object representing the completed or aborted operation that is, despite the name, no longer running.
An error is returned if the operation either fails to start or is cancelled. If the operation runs to completion then no error is returned even if the operation itself is unsuccessful. Use the "Result" field of the returned operation object to recognize operation-level failure.
func (*Meta) SetWorkspace ¶
SetWorkspace saves the given name as the current workspace in the local filesystem.
func (*Meta) StateOutPath ¶
StateOutPath returns the true output path for the state file
func (*Meta) StaticConfigInstance ¶
func (m *Meta) StaticConfigInstance(ctx context.Context, root *configs.Module, modules eval.ExternalModules) (*eval.ConfigInstance, tfdiags.Diagnostics)
func (*Meta) Workspace ¶
Workspace returns the name of the currently configured workspace, corresponding to the desired named state.
func (*Meta) WorkspaceOverridden ¶
WorkspaceOverridden returns the name of the currently configured workspace, corresponding to the desired named state, as well as a bool saying whether this was set via the TF_WORKSPACE environment variable.
type MigrateTFCCommand ¶
type MigrateTFCCommand struct {
StateMeta
}
MigrateTFCCommand implements "migrate tfc".
func (MigrateTFCCommand) Execute ¶
func (c MigrateTFCCommand) Execute(args *arguments.MigrateTFC, view views.State, out io.Writer) int
type OutputCommand ¶
type OutputCommand struct {
Meta
}
OutputCommand is a Command implementation that reads an output from a Bogform state and prints it.
func (*OutputCommand) Outputs ¶
func (c *OutputCommand) Outputs(ctx context.Context, statePath string, enc encryption.Encryption) (map[string]*states.OutputValue, tfdiags.Diagnostics)
type PlanCommand ¶
type PlanCommand struct {
Meta
}
PlanCommand is a Command implementation that compares a Bogform configuration to an actual infrastructure and shows the differences.
func (*PlanCommand) OperationRequest ¶
func (c *PlanCommand) OperationRequest( ctx context.Context, be backend.Enhanced, view views.Plan, viewOptions *arguments.View, args *arguments.Operation, planOutPath string, generateConfigOut string, enc encryption.Encryption, ) (*backend.Operation, tfdiags.Diagnostics)
func (*PlanCommand) PrepareBackend ¶
func (c *PlanCommand) PrepareBackend(ctx context.Context, args *arguments.State, view views.Plan, enc encryption.Encryption) (backend.Enhanced, tfdiags.Diagnostics)
type ProvidersCommand ¶
type ProvidersCommand struct {
Meta
}
ProvidersCommand is a Command implementation that prints out information about the providers used in the current configuration/state.
type ProvidersLockCommand ¶
type ProvidersLockCommand struct {
Meta
}
ProvidersLockCommand is a Command implementation that implements the "bogform providers lock" command, which creates or updates the current configuration's dependency lock file using information from upstream registries, regardless of the provider installation configuration that is configured for normal provider installation.
func (ProvidersLockCommand) Execute ¶
func (c ProvidersLockCommand) Execute(args *arguments.ProvidersLock, view views.ProvidersLock) int
type ProvidersMirrorCommand ¶
type ProvidersMirrorCommand struct {
Meta
}
ProvidersMirrorCommand is a Command implementation that implements the "bogform providers mirror" command, which populates a directory with local copies of provider plugins needed by the current configuration so that the mirror can be used to work offline, or similar.
func (ProvidersMirrorCommand) Execute ¶
func (c ProvidersMirrorCommand) Execute(args *arguments.ProvidersMirror, view views.ProvidersMirror) int
type ProvidersSchemaCommand ¶
type ProvidersSchemaCommand struct {
Meta
}
ProvidersSchemaCommand is a Command implementation that prints out information about the providers used in the current configuration/state.
func (ProvidersSchemaCommand) Execute ¶
func (c ProvidersSchemaCommand) Execute(args *arguments.ProvidersSchema, view views.ProvidersSchema) int
type PushCommand ¶
type PushCommand struct {
Meta
}
func (*PushCommand) Help ¶
func (c *PushCommand) Help() string
func (*PushCommand) Run ¶
func (c *PushCommand) Run(rawArgs []string) int
func (*PushCommand) Synopsis ¶
func (c *PushCommand) Synopsis() string
type RefreshCommand ¶
type RefreshCommand struct {
Meta
}
RefreshCommand is a cli.Command implementation that refreshes the state file.
func (*RefreshCommand) OperationRequest ¶
func (c *RefreshCommand) OperationRequest(ctx context.Context, be backend.Enhanced, view views.Refresh, args *arguments.Operation, enc encryption.Encryption, ) (*backend.Operation, tfdiags.Diagnostics)
func (*RefreshCommand) PrepareBackend ¶
func (c *RefreshCommand) PrepareBackend(ctx context.Context, args *arguments.State, view views.Refresh, enc encryption.Encryption) (backend.Enhanced, tfdiags.Diagnostics)
type ShowCommand ¶
type ShowCommand struct {
Meta
// contains filtered or unexported fields
}
ShowCommand is a Command implementation that reads and outputs the contents of a Bogform plan or state file. write about config here
type StateCommand ¶
type StateCommand struct {
StateMeta
}
StateCommand is a Command implementation that just shows help for the subcommands nested below it.
func (*StateCommand) Help ¶
func (c *StateCommand) Help() string
func (*StateCommand) Run ¶
func (c *StateCommand) Run(_ []string) int
func (*StateCommand) Synopsis ¶
func (c *StateCommand) Synopsis() string
type StateHistoryCommand ¶
type StateHistoryCommand struct {
StateMeta
}
StateHistoryCommand lists the versions of a workspace's state.
func (StateHistoryCommand) Execute ¶
func (c StateHistoryCommand) Execute(args *arguments.StateHistory, view *views.Text) int
type StateListCommand ¶
type StateListCommand struct {
StateMeta
}
StateListCommand is a Command implementation that lists the resources within a state file.
type StateMeta ¶
type StateMeta struct {
Meta
}
StateMeta is the meta struct that should be embedded in state subcommands.
func (*StateMeta) State ¶
func (c *StateMeta) State(ctx context.Context, enc encryption.Encryption, view views.State) (statemgr.Full, error)
State returns the state for this meta. This gets the appropriate state from the backend, but changes the way that backups are done. This configures backups to be timestamped rather than just the original state path plus a backup path.
type StateMvCommand ¶
type StateMvCommand struct {
StateMeta
}
StateMvCommand is a Command implementation that shows a single resource.
type StatePullCommand ¶
type StatePullCommand struct {
StateMeta
}
StatePullCommand is a Command implementation that shows a single resource.
type StatePushCommand ¶
type StatePushCommand struct {
StateMeta
}
StatePushCommand is a Command implementation that shows a single resource.
type StateRekeyCommand ¶
type StateRekeyCommand struct {
StateMeta
}
StateRekeyCommand rewrites state with the primary encryption method.
func (StateRekeyCommand) Execute ¶
func (c StateRekeyCommand) Execute(args *arguments.StateRekey, view *views.Text, stateView views.State) int
type StateReplaceProviderCommand ¶
type StateReplaceProviderCommand struct {
StateMeta
}
StateReplaceProviderCommand is a Command implementation that allows users to change the provider associated with existing resources. This is only likely to be useful if a provider is forked or changes its fully-qualified name.
func (StateReplaceProviderCommand) Execute ¶
func (c StateReplaceProviderCommand) Execute(args *arguments.StateReplaceProvider, view views.State) int
type StateRestoreCommand ¶
type StateRestoreCommand struct {
StateMeta
}
StateRestoreCommand writes an earlier version of a workspace's state as its current state.
func (StateRestoreCommand) Execute ¶
func (c StateRestoreCommand) Execute(args *arguments.StateRestore, view *views.Text, stateView views.State) int
type StateRmCommand ¶
type StateRmCommand struct {
StateMeta
}
StateRmCommand is a Command implementation that shows a single resource.
type StateShowCommand ¶
type StateShowCommand struct {
StateMeta
}
StateShowCommand is a Command implementation that shows a single resource.
type TaintCommand ¶
type TaintCommand struct {
Meta
}
TaintCommand is a cli.Command implementation that manually taints a resource, marking it for recreation.
type TestCommand ¶
type TestCommand struct {
Meta
}
type TestFileRunner ¶
type TestFileRunner struct {
Suite *TestSuiteRunner
States map[string]*TestFileState
}
func (*TestFileRunner) Cleanup ¶
func (runner *TestFileRunner) Cleanup(ctx context.Context, file *moduletest.File)
func (*TestFileRunner) ExecuteTestFile ¶
func (runner *TestFileRunner) ExecuteTestFile(ctx context.Context, file *moduletest.File)
func (*TestFileRunner) ExecuteTestRun ¶
func (runner *TestFileRunner) ExecuteTestRun(ctx context.Context, run *moduletest.Run, file *moduletest.File, state *states.State, config *configs.Config) (*states.State, bool)
type TestFileState ¶
type TestFileState struct {
Run *moduletest.Run
State *states.State
}
type TestSuiteRunner ¶
type TestSuiteRunner struct {
Suite *moduletest.Suite
Config *configs.Config
GlobalVariables map[string]backend.UnparsedVariableValue
Opts *tofu.ContextOpts
View views.Test
// Stopped and Cancelled track whether the user requested the testing
// process to be interrupted. Stopped is a nice graceful exit, we'll still
// tidy up any state that was created and mark the tests with relevant
// `skipped` status updates. Cancelled is a hard stop right now exit, we
// won't attempt to clean up any state left hanging, and tests will just
// be left showing `pending` as the status. We will still print out the
// destroy summary diagnostics that tell the user what state has been left
// behind and needs manual clean up.
Stopped bool
Cancelled bool
// StoppedCtx and CancelledCtx allow in progress Bogform operations to
// respond to external calls from the test command.
StoppedCtx context.Context
CancelledCtx context.Context
// Verbose tells the runner to print out plan files during each test run.
Verbose bool
// contains filtered or unexported fields
}
func (*TestSuiteRunner) Start ¶
func (runner *TestSuiteRunner) Start(ctx context.Context)
type UIInput ¶
type UIInput struct {
// Colorize will color the output.
Colorize *colorstring.Colorize
// Reader and Writer for IO. If these aren't set, they will default to
// Stdin and Stdout respectively.
Reader io.Reader
Writer io.Writer
// contains filtered or unexported fields
}
UIInput is an implementation of tofu.UIInput that asks the CLI for input stdin.
type UnlockCommand ¶
type UnlockCommand struct {
Meta
}
UnlockCommand is a cli.Command implementation that manually unlocks the state.
type UntaintCommand ¶
type UntaintCommand struct {
Meta
}
UntaintCommand is a cli.Command implementation that manually untaints a resource, marking it as primary and ready for service.
type UsageOverride ¶
type ValidateCommand ¶
type ValidateCommand struct {
Meta
}
ValidateCommand is a Command implementation that validates the tofu files
type VersionCommand ¶
type VersionCommand struct {
Meta
Version string
VersionPrerelease string
Platform getproviders.Platform
}
VersionCommand is a Command implementation prints the version.
type WorkspaceDeleteCommand ¶
func (WorkspaceDeleteCommand) AutocompleteArgs ¶
func (c WorkspaceDeleteCommand) AutocompleteArgs() []string
func (WorkspaceDeleteCommand) Execute ¶
func (c WorkspaceDeleteCommand) Execute(args *arguments.WorkspaceDelete, view views.Workspace) int
type WorkspaceListCommand ¶
func (WorkspaceListCommand) Execute ¶
func (c WorkspaceListCommand) Execute(args *arguments.WorkspaceList, view views.Workspace) int
type WorkspaceNewCommand ¶
func (WorkspaceNewCommand) Execute ¶
func (c WorkspaceNewCommand) Execute(args *arguments.WorkspaceNew, view views.Workspace) int
type WorkspaceSelectCommand ¶
func (WorkspaceSelectCommand) AutocompleteArgs ¶
func (c WorkspaceSelectCommand) AutocompleteArgs() []string
func (WorkspaceSelectCommand) Execute ¶
func (c WorkspaceSelectCommand) Execute(args *arguments.WorkspaceSelect, view views.Workspace) int
type WorkspaceShowCommand ¶
type WorkspaceShowCommand struct {
Meta
}
func (WorkspaceShowCommand) Execute ¶
func (c WorkspaceShowCommand) Execute(args *arguments.WorkspaceShow, view views.Workspace) int
Source Files
¶
- adopt.go
- apply.go
- apply_e2etesting.go
- autocomplete.go
- bootstrap.go
- ci.go
- command.go
- console.go
- console_interactive.go
- console_state.go
- doctor.go
- fmt.go
- get.go
- graph.go
- helper.go
- hook_module_install.go
- import.go
- init.go
- login.go
- logout.go
- meta.go
- meta_backend.go
- meta_backend_migrate.go
- meta_config.go
- meta_dependencies.go
- meta_encryption.go
- meta_new.go
- meta_providers.go
- meta_vars.go
- metadata_command.go
- metadata_functions.go
- migrate.go
- output.go
- plan.go
- plugins.go
- providers.go
- providers_lock.go
- providers_mirror.go
- providers_schema.go
- push.go
- refresh.go
- show.go
- state_command.go
- state_history.go
- state_list.go
- state_meta.go
- state_mv.go
- state_pull.go
- state_push.go
- state_rekey.go
- state_replace_provider.go
- state_rm.go
- state_show.go
- taint.go
- temp_new_runtime.go
- test.go
- ui.go
- ui_input.go
- unlock.go
- untaint.go
- validate.go
- version.go
- workspace_command.go
- workspace_delete.go
- workspace_list.go
- workspace_new.go
- workspace_select.go
- workspace_show.go
Directories
¶
| Path | Synopsis |
|---|---|
|
Package cliconfig has the types representing and the logic to load CLI-level configuration settings.
|
Package cliconfig has the types representing and the logic to load CLI-level configuration settings. |
|
ociauthconfig
Package ociauthconfig contains types used for describing OCI authentication settings, and helpers for discovering such settings from container engine configuration files as described in https://github.com/containers/image/blob/main/docs/containers-auth.json.5.md .
|
Package ociauthconfig contains types used for describing OCI authentication settings, and helpers for discovering such settings from container engine configuration files as described in https://github.com/containers/image/blob/main/docs/containers-auth.json.5.md . |
|
svcauthconfig
Package svcauthconfig contains some helper functions and types to support the cliconfig package's use of github.com/opentofu/svchost/svcauth, which is our mechanism for representing the policy for authenticating to Bogform-native services such as implementations Bogform's provider registry protocol.
|
Package svcauthconfig contains some helper functions and types to support the cliconfig package's use of github.com/opentofu/svchost/svcauth, which is our mechanism for representing the policy for authenticating to Bogform-native services such as implementations Bogform's provider registry protocol. |
|
Package state exposes common helpers for working with state from the CLI.
|
Package state exposes common helpers for working with state from the CLI. |
|
Package e2etest contains a set of tests that run against a real Bogform binary, compiled on the fly at the start of the test run.
|
Package e2etest contains a set of tests that run against a real Bogform binary, compiled on the fly at the start of the test run. |
|
fakeocireg
Package fakeocireg provides a minimal, read-only implementation of the OCI Distribution protocol that interacts with a local filesystem directory.
|
Package fakeocireg provides a minimal, read-only implementation of the OCI Distribution protocol that interacts with a local filesystem directory. |
|
provider-simple
simple provider a minimal provider implementation for testing
|
simple provider a minimal provider implementation for testing |
|
provider-simple-v6
simple provider a minimal provider implementation for testing
|
simple provider a minimal provider implementation for testing |
|
provider-simple-v6/main
command
|
|
|
provider-simple/main
command
|
|
|
provisioner-local-exec/main
command
|
|
|
Package format contains helpers for formatting various Bogform structures for human-readable output.
|
Package format contains helpers for formatting various Bogform structures for human-readable output. |
|
Package jsonchecks implements the common JSON representation of check results/statuses that we use across both the JSON plan and JSON state representations.
|
Package jsonchecks implements the common JSON representation of check results/statuses that we use across both the JSON plan and JSON state representations. |
|
Package jsonconfig implements methods for outputting a configuration snapshot in machine-readable json format
|
Package jsonconfig implements methods for outputting a configuration snapshot in machine-readable json format |
|
Package jsonentities contains the entities for representing a few common resources used around the json* packages.
|
Package jsonentities contains the entities for representing a few common resources used around the json* packages. |
|
computed
Package computed contains types that represent the computed diffs for Bogform blocks, attributes, and outputs.
|
Package computed contains types that represent the computed diffs for Bogform blocks, attributes, and outputs. |
|
structured
Package structured contains the structured representation of the JSON changes returned by the jsonplan package.
|
Package structured contains the structured representation of the JSON changes returned by the jsonplan package. |
|
Package jsonplan implements methods for outputting a plan in a machine-readable json format
|
Package jsonplan implements methods for outputting a plan in a machine-readable json format |
|
Package jsonprovider contains types and functions to marshal Bogform provider schemas into a json formatted output.
|
Package jsonprovider contains types and functions to marshal Bogform provider schemas into a json formatted output. |
|
Package jsonstate implements methods for outputting a state in a machine-readable json format
|
Package jsonstate implements methods for outputting a state in a machine-readable json format |
|
Package workdir models the various local artifacts and state we keep inside a Bogform "working directory".
|
Package workdir models the various local artifacts and state we keep inside a Bogform "working directory". |