Documentation
¶
Index ¶
- Constants
- func ParseLintingRules(rules []string) (collections.Set[linting.RuleAddr], collections.Set[linting.RuleAddr])
- type Apply
- type Argument
- type Backend
- type CommandLine
- func (c *CommandLine) BoolVar(p *bool, name string, value bool, usage string) *Flag
- func (c *CommandLine) BoolVarWithShortAlias(p *bool, name string, short rune, value bool, usage string) *Flag
- func (c *CommandLine) CliArguments() []cli.Argument
- func (c *CommandLine) CliFlags() []cli.Flag
- func (c *CommandLine) DurationVar(p *time.Duration, name string, value time.Duration, usage string) *Flag
- func (c *CommandLine) Flag(flag *Flag) *Flag
- func (c *CommandLine) IntVar(p *int, name string, value int, usage string) *Flag
- func (c *CommandLine) ParseDirect(ctx context.Context, args []string) tfdiags.Diagnostics
- func (c *CommandLine) PositionalArg(p *string, name string, optional bool)
- func (c *CommandLine) PositionalError(remaining []string, argsErrored bool) tfdiags.Diagnostics
- func (c *CommandLine) PostHook(h func() tfdiags.Diagnostics)
- func (c *CommandLine) PreHook(h func() tfdiags.Diagnostics)
- func (c *CommandLine) RawFlags(p flags.RawFlags, name string, usage string) *Flag
- func (c *CommandLine) RemainCheck(remaining []string) tfdiags.Diagnostics
- func (c *CommandLine) StringArrayVar(p *[]string, name string, value []string, usage string) *Flag
- func (c *CommandLine) StringVar(p *string, name string, value string, usage string) *Flag
- func (c *CommandLine) VariadicArg(p *[]string, name string)
- type Console
- type DeprecationWarningLevel
- type Flag
- type FlagGroup
- type Fmt
- type Get
- type Graph
- type Hook
- type Hooks
- type Import
- type Init
- type Login
- type Logout
- type MetadataFunctions
- type MigrateTFC
- type Operation
- type Output
- type Plan
- type Providers
- type ProvidersLock
- type ProvidersMirror
- type ProvidersSchema
- type Refresh
- type Show
- type ShowTargetType
- type State
- type StateHistory
- type StateList
- type StateMv
- type StatePassphrase
- type StatePull
- type StatePush
- type StateRekey
- type StateReplaceProvider
- type StateRestore
- type StateRm
- type StateShow
- type Taint
- type Test
- type Unlock
- type Validate
- type Vars
- type Version
- type View
- type ViewType
- type Workspace
- type WorkspaceDelete
- type WorkspaceList
- type WorkspaceNew
- type WorkspaceSelect
- type WorkspaceShow
Constants ¶
const DefaultParallelism = 10
DefaultParallelism is the limit Bogform places on total parallel operations as it walks the dependency graph.
const DefaultStateFilename = "terraform.tfstate"
DefaultStateFilename is the default filename used for the state file.
Variables ¶
This section is empty.
Functions ¶
func ParseLintingRules ¶
func ParseLintingRules(rules []string) (collections.Set[linting.RuleAddr], collections.Set[linting.RuleAddr])
ParseLintingRules is a utility function that coordinates the parsing of a raw string into structured linting rules.
The lintingRulesRaw string argument is expected to contain a string separated list of linting rules to be executed or skipped.
Format: rule1,rule2,!rule3,!rule4
which will translate to "include rule1 and rule2" and "exclude rule3 and rule4".
Any parsing failure will be only logged. Due to the nature of the linting feature, we want to be permissive in this layer since migrating from one Bogform version to another some rules might be changed or removed which should not break the existing operators configuration.
This function allows for the same rule to be included and excluded but will warn about it. Due to the filtering rules in the internal/tfdiags/lint.go, in situations where the same rule is included and excluded, the inclusion will take precedence.
Types ¶
type Apply ¶
type Apply struct {
// State, Operation, and Vars are the common extended flags
State *State
Operation *Operation
Vars *Vars
// AutoApprove skips the manual verification step for the apply operation.
AutoApprove bool
// PlanPath contains an optional path to a stored plan file
PlanPath string
// View represents the global view options
View *View
// SuppressForgetErrorsDuringDestroy suppresses the error that occurs when a
// destroy operation completes successfully but leaves forgotten instances behind.
SuppressForgetErrorsDuringDestroy bool
}
Apply represents the command-line arguments for the apply command.
func BindApply ¶
func BindApply(cli *CommandLine) *Apply
BindApply registers CLI arguments, returning a Apply value and it's corresponding hooks.
func BindApplyDestroy ¶
func BindApplyDestroy(cli *CommandLine) *Apply
BindApplyDestroy registers CLI arguments, returning a Apply value and it's corresponding hooks.
func ParseApply ¶
func ParseApply(args []string) (*Apply, func(), tfdiags.Diagnostics)
ParseApply processes CLI arguments, returning an Apply value, a closer function, and errors. If errors are encountered, an Apply value is still returned representing the best effort interpretation of the arguments.
func ParseApplyDestroy ¶
func ParseApplyDestroy(args []string) (*Apply, func(), tfdiags.Diagnostics)
ParseApplyDestroy is a special case of ParseApply that deals with the "bogform destroy" command, which is effectively an alias for "bogform apply -destroy".
type Argument ¶
type Argument struct {
Name string
Optional bool
Variadic bool
// Process takes the current remaining os.Args entries and returns
// the remainder after the given argument has been processed.
Process func([]string) ([]string, error)
Cli cli.Argument
}
Argument represents a positional argument.
type Backend ¶
type Backend struct {
// IgnoreRemoteVersion is used with commands which write state to allow users to write remote
// state even if the remote and local Bogform versions don't match.
IgnoreRemoteVersion bool
// ForceInitCopy suppresses confirmation for copying state data during init.
ForceInitCopy bool
// Reconfigure forces init to ignore any stored configuration.
Reconfigure bool
// MigrateState confirms the user wishes to migrate from the prior backend configuration to a new configuration.
MigrateState bool
}
func BindBackend ¶
func BindBackend(cli *CommandLine) *Backend
func BindBackendWithMigration ¶
func BindBackendWithMigration(cli *CommandLine) *Backend
type CommandLine ¶
type CommandLine struct {
// Flags represents all flags available to the command line.
Flags map[string]*Flag
// FlagGroups defines the group headers for the Flags. These are
// only used in a few specific commands for now and are typically
// left empty.
FlagGroups []FlagGroup
// Args contains the positional arguments defined for a given command.
// These are only allowed after all of the flag parsing is complete.
Args []Argument
// ArgsHelp is a field used to customize the argument error help text.
// This is a legacy option and should not be used for any new commands.
ArgHelp string
// PreHooks contain the logic that should be run between os.Args
// handling and the actual command logic.
PreHooks Hooks
// PostHooks contain the logic that should be run after the command
// has completed and before os.Exit is called.
// This is typically only used for the --json-into special case.
PostHooks Hooks
// This is a bit of a hack so we can correctly report diagnostics before actually executing the command
View *View
// These are hacks for the meta struct that should be removed as the meta struct is broken up and removed
Backend *Backend
Operation *Operation
State *State
Vars *Vars
}
CommandLine represents the information need to represent the cli options available to a given Bogform command. It is used for both argument handling and help text construction.
func (*CommandLine) BoolVarWithShortAlias ¶
func (c *CommandLine) BoolVarWithShortAlias(p *bool, name string, short rune, value bool, usage string) *Flag
BoolVarWithShort attaches a bool flag to the CommandLine, giving both a long name and a short (one-rune) alias.
This is a specialized variant of CommandLine.BoolVar for situations where a boolean-only option has a single-character variant, such as with "--version" and "-v". Note that Bogform intentionally does not offer single-character aliases for most options, so most new options should not use this function.
func (*CommandLine) CliArguments ¶
func (c *CommandLine) CliArguments() []cli.Argument
CliArguments builds the set of positional arguments to be attached to a command
func (*CommandLine) CliFlags ¶
func (c *CommandLine) CliFlags() []cli.Flag
CliFlags builds the set of flags to be attached to a command
func (*CommandLine) DurationVar ¶
func (c *CommandLine) DurationVar(p *time.Duration, name string, value time.Duration, usage string) *Flag
DurationVar attaches a time.Duration flag to the CommandLine.
func (*CommandLine) Flag ¶
func (c *CommandLine) Flag(flag *Flag) *Flag
Flag registers the given flag to the CommandLine.
func (*CommandLine) ParseDirect ¶
func (c *CommandLine) ParseDirect(ctx context.Context, args []string) tfdiags.Diagnostics
ParseDirect is only used for testing when we need to simuate processing the args. This is primarilly used in the command package.
func (*CommandLine) PositionalArg ¶
func (c *CommandLine) PositionalArg(p *string, name string, optional bool)
PositionalArg registers a positional argument.
func (*CommandLine) PositionalError ¶
func (c *CommandLine) PositionalError(remaining []string, argsErrored bool) tfdiags.Diagnostics
PositionalError is the common error handling of remaining positional arguments
func (*CommandLine) PostHook ¶
func (c *CommandLine) PostHook(h func() tfdiags.Diagnostics)
PostHook is a helper function to add a hook to the command line processing.
func (*CommandLine) PreHook ¶
func (c *CommandLine) PreHook(h func() tfdiags.Diagnostics)
PreHook is a helper function to add a hook to the command line processing.
func (*CommandLine) RawFlags ¶
RawFlags attaches a flags.RawFlags to the CommandLine. This is a deprecated function and should be removed once var and var-file processing is improved. This will correspond with the removal of the flags package.
func (*CommandLine) RemainCheck ¶
func (c *CommandLine) RemainCheck(remaining []string) tfdiags.Diagnostics
RemainCheck handles positional arguments and produces a corresponding error if nessesary.
func (*CommandLine) StringArrayVar ¶
StringArrayVar attaches a StringArray flag to the CommandLine. This treats every instance of -name is a new entry and does not perform any ',' splitting.
func (*CommandLine) VariadicArg ¶
func (c *CommandLine) VariadicArg(p *[]string, name string)
VariadicArg registers a variadic argument.
type Console ¶
type Console struct {
// View represents the global view options
View *View
// Vars holds and provides information for the flags related to variables that a user can give into the process
Vars *Vars
// State is used for the state related flags
State *State
}
Console represents the command-line arguments for the console command.
func BindConsole ¶
func BindConsole(cli *CommandLine) *Console
BindConsole registers CLI arguments, returning a Console value and it's corresponding hooks.
func ParseConsole ¶
func ParseConsole(args []string) (*Console, func(), tfdiags.Diagnostics)
ParseConsole processes CLI arguments, returning a Console value, a closer function, and errors. If errors are encountered, a Console value is still returned representing the best effort interpretation of the arguments.
type DeprecationWarningLevel ¶
type DeprecationWarningLevel uint8
DeprecationWarningLevel defines different levels of deprecation warnings that can be used by the user to control what type of warnings it wants to see
const ( // DeprecationWarningLevelAll shows all deprecation warnings for outputs and variables, where no filtering is applied. DeprecationWarningLevelAll DeprecationWarningLevel = iota // DeprecationWarningLevelLocal shows only the deprecation warnings for the outputs and variables that are coming from // modules that are referenced with a relative path (aka local module). DeprecationWarningLevelLocal // DeprecationWarningLevelNone disables any deprecation warnings, filtering out any diagnostic that was generated about // this. DeprecationWarningLevelNone )
func ParseDeprecatedWarningLevel ¶
func ParseDeprecatedWarningLevel(s string) DeprecationWarningLevel
ParseDeprecatedWarningLevel gets in a string and returns a DeprecationWarningLevel. Since these warnings are not critical to the system, this method is returning no error when the warn level identifier is missing a mapping. Instead, it falls back on returning the level that will write all the deprecation warnings.
func (DeprecationWarningLevel) String ¶
func (i DeprecationWarningLevel) String() string
type Flag ¶
type Flag struct {
// Name is the name of the flag.
Name string
// Usage is the usage text that will be formatted. It may include
// newlines, but it is discouraged.
Usage string
// GroupID is the group that this flag is nested under. This is
// for formatting in the help/usage text.
GroupID string
// Display is a suffix for the Name during help text formatting. For example:
// Display: "=value", would render as
// --flag-name=value
Display string
// Hidden determines if this flag be visible in help text.
Hidden bool
// Global determines if this flag is allowed to intermix with positional
// arguments. This is a view holdover and should be considered for removal
// at some future date.
Global bool
// Cli implementation of this flag (urfave/cli)
Cli func() cli.Flag
// IsSet is a workaround for -backend and -cloud. TODO consider
// proper argument aliases as supported by the cli implementation.
IsSet func() bool
}
Flag is our representation of a command line flag and the implementation details of interfacing it with a given command line library.
func (*Flag) SetDisplay ¶
type FlagGroup ¶
type FlagGroup struct {
// ID corresponds to flag's GroupID
ID string
// Title of the group
Title string
// Description present below the title
Description string
// Suffix text for after the group flags have
// been rendered
Suffix string
}
FlagGroup is the information needed to define a flag grouping for help text display.
type Fmt ¶
type Fmt struct {
// Paths contains the file paths that the formatter will handle.
// When no arguments given to the command, it will use the current directory.
// If the first argument is -, it will read the content to format from [os.Stdin].
Paths []string
// List controls the output of the formatted list. If disabled, it will not print the
// names of the formatted files.
List bool
// Write controls if the formatter should write the content back to the check file or not.
Write bool
// Diff tells to the formatter to print the diff between the before and after formatting
// process.
Diff bool
// Check can be used to instruct the command to return a non-zero error code if it finds
// any file that is not properly formatted.
Check bool
// Recursive indicates that the formatting should be done recursive through all the
// subdirectories.
Recursive bool
// View represents the global view options
View *View
}
Fmt represents the command-line arguments for the fmt command.
func BindFmt ¶
func BindFmt(cli *CommandLine) *Fmt
BindFmt registers CLI arguments, returning a Fmt value and it's corresponding hooks.
type Get ¶
type Get struct {
// Update is the flag that can be used to upgrade the version of the modules.
Update bool
// TestsDirectory indicates the path where the tests are stored
TestsDirectory string
// Vars holds and provides information for the flags related to variables that a user can give into the process
Vars *Vars
// View represents the global view options
View *View
}
Get represents the command-line arguments for the get command.
func BindGet ¶
func BindGet(cli *CommandLine) *Get
BindGet registers CLI arguments, returning a Get value and it's corresponding hooks.
type Graph ¶
type Graph struct {
// DrawCycles highlights any cycles in the graph with colored edges.
DrawCycles bool
// GraphType specifies the type of graph to output (plan, plan-refresh-only, plan-destroy, or apply).
GraphType string
// ModuleDepth specifies the depth of modules to show in the output.
ModuleDepth int
// Verbose enables verbose output.
Verbose bool
// PlanPath specifies the path to a plan file to render the graph from.
PlanPath string
// View represents the global view options
View *View
// Vars holds and provides information for the flags related to variables that a user can give into the process
Vars *Vars
}
Graph represents the command-line arguments for the graph command.
func BindGraph ¶
func BindGraph(cli *CommandLine) *Graph
BindGraph registers CLI arguments, returning a Graph value and it's corresponding hooks.
func ParseGraph ¶
func ParseGraph(args []string) (*Graph, func(), tfdiags.Diagnostics)
ParseGraph processes CLI arguments, returning a Graph value, a closer function, and errors. If errors are encountered, a Graph value is still returned representing the best effort interpretation of the arguments.
type Hook ¶
type Hook func() tfdiags.Diagnostics
Hook is a function that will be executed pre or post command execution
type Hooks ¶
type Hooks []Hook
Hooks is a list of hooks with a helper method
func (Hooks) Run ¶
func (h Hooks) Run() tfdiags.Diagnostics
Run executes all hooks sequentially and returns any diagnostics encountered.
type Import ¶
type Import struct {
// ResourceAddress is the absolute resource address that the user is required to provide to indicate
// on which configuration resource the state of the resource needs to be imported.
ResourceAddress string
// ResourceID is the platform provided ID of the resource to be imported.
ResourceID string
// ConfigPath is the path to the directory where the configuration containing the ResourceAddress is
// accessible.
ConfigPath string
// Parallelism is the limit of concurrent operation as Bogform walks the graph
Parallelism int
// View represents the global view options
View *View
// State, Backend and Vars are the common extended flags
State *State
Backend *Backend
Vars *Vars
}
Import represents the command-line arguments for the import command.
func BindImport ¶
func BindImport(cli *CommandLine) *Import
BindImport registers CLI arguments, returning a Import value and it's corresponding hooks.
func ParseImport ¶
func ParseImport(args []string) (*Import, func(), tfdiags.Diagnostics)
ParseImport processes CLI arguments, returning an Import value, a closer function, and errors. If errors are encountered, an Import value is still returned representing the best effort interpretation of the arguments.
type Init ¶
type Init struct {
// Copy the contents of the given module into the target directory before initialisation
FlagFromModule string
// Lockfile operation mode. Currently only "readonly" is valid.
FlagLockfile string
// Set the Bogform test directory. When set, the
// test command will search for test files in the current directory and
// in the one specified by the flag.
TestsDirectory string
// When set to false, disables modules downloading for the current configuration
FlagGet bool
// Install the latest module and provider versions allowed within configured constraints, overriding the
// default behavior of selecting exactly the version recorded in the dependency lockfile.
FlagUpgrade bool
// Directory containing plugin binaries. This overrides all default search paths for plugins, and prevents the
// automatic installation of plugins. This flag can be used multiple times.
FlagPluginPath []string
// Configuration to be merged with what is in the configuration file's 'backend' block. This can be
// either a path to an HCL file with key/value assignments (same format as terraform.tfvars) or a
// 'key=value' format, and can be specified multiple times. The backend type must be in the configuration itself.
FlagConfigExtra flagspkg.RawFlags
// Disable backend initialization for this configuration and use what was previously
// initialized instead. This and the FlagCloud cannot be toggled in the same time.
FlagBackend bool
FlagCloud bool
// Bools indicating that the FlagBackend and FlagCloud have been found into the arguments list of the
// process.
BackendFlagSet bool
CloudFlagSet bool
// View represents the global view options
View *View
// Vars holds and provides information for the flags related to variables that a user can give into the process
Vars *Vars
// Backend holds and providers information for the flags related to the backend operations, like locking
// locking timeout, force migration, etc.
Backend *Backend
// State is used for the state related flags
State *State
}
Init represents the command-line arguments for the init command.
func BindInit ¶
func BindInit(cli *CommandLine) *Init
BindInit registers CLI arguments, returning a Init value and it's corresponding hooks.
type Login ¶
type Login struct {
// Host represents the host that Bogform will try to login to
Host string
// View represents the global view options
View *View
// Vars and State are the common extended flags
Vars *Vars
State *State
}
Login represents the command-line arguments for the login command.
func BindLogin ¶
func BindLogin(cli *CommandLine) *Login
BindLogin registers CLI arguments, returning a Login value and it's corresponding hooks.
func ParseLogin ¶
func ParseLogin(args []string) (*Login, func(), tfdiags.Diagnostics)
ParseLogin processes CLI arguments, returning a Login value, a closer function, and errors. If errors are encountered, a Login value is still returned representing the best effort interpretation of the arguments.
type Logout ¶
type Logout struct {
// Host represents the host that Bogform will try to log out of
Host string
// View represents the global view options
View *View
}
Logout represents the command-line arguments for the logout command.
func BindLogout ¶
func BindLogout(cli *CommandLine) *Logout
BindLogout registers CLI arguments, returning a Logout value and it's corresponding hooks.
func ParseLogout ¶
func ParseLogout(args []string) (*Logout, func(), tfdiags.Diagnostics)
ParseLogout processes CLI arguments, returning a Logout value, a closer function, and errors. If errors are encountered, a Logout value is still returned representing the best effort interpretation of the arguments.
type MetadataFunctions ¶
type MetadataFunctions struct {
// View represents the global view options
View *View
}
MetadataFunctions represents the command-line arguments for the "metadata functions" command.
func BindMetadataFunctions ¶
func BindMetadataFunctions(cli *CommandLine) *MetadataFunctions
BindMetadataFunctions registers CLI arguments, returning a MetadataFunctions value and it's corresponding hooks.
func ParseMetadataFunctions ¶
func ParseMetadataFunctions(args []string) (*MetadataFunctions, func(), tfdiags.Diagnostics)
ParseMetadataFunctions processes CLI arguments, returning a MetadataFunctions value, a closer function, and errors. If errors are encountered, a MetadataFunctions value is still returned representing the best effort interpretation of the arguments.
type MigrateTFC ¶
type MigrateTFC struct {
// Organization is the HCP Terraform organization.
Organization string
// Workspaces are the HCP Terraform workspaces to move.
Workspaces []string
// Hostname is the HCP Terraform or Terraform Enterprise host.
Hostname string
// DryRun reads everything but writes no state.
DryRun bool
// Force overwrites state that already exists in the new backend.
Force bool
// ShowValues prints the values of variables that aren't sensitive.
ShowValues bool
View *View
Vars *Vars
Backend *Backend
State *State
}
MigrateTFC represents the command-line arguments for the "migrate tfc" command.
func BindMigrateTFC ¶
func BindMigrateTFC(cli *CommandLine) *MigrateTFC
BindMigrateTFC registers the "migrate tfc" command's arguments.
type Operation ¶
type Operation struct {
// PlanMode selects one of the mutually-exclusive planning modes that
// decides the overall goal of a plan operation. This field is relevant
// only for an operation that produces a plan.
PlanMode plans.Mode
// Parallelism is the limit Bogform places on total parallel operations
// as it walks the dependency graph.
Parallelism int
// Refresh controls whether or not the operation should refresh existing
// state before proceeding. Default is true.
Refresh bool
// Targets allow limiting an operation to a set of resource addresses and
// their dependencies.
Targets []addrs.Targetable
// Excludes allow limiting an operation to execute on all resources other
// than a set of excluded resource addresses and resources dependent on them.
Excludes []addrs.Targetable
// ForceReplace addresses cause Bogform to force a particular set of
// resource instances to generate "replace" actions in any plan where they
// would normally have generated "no-op" or "update" actions.
//
// This is currently limited to specific instances because typical uses
// of replace are associated with only specific remote objects that the
// user has somehow learned to be malfunctioning, in which case it
// would be unusual and potentially dangerous to replace everything under
// a module all at once. We could potentially loosen this later if we
// learn a use-case for broader matching.
ForceReplace []addrs.AbsResourceInstance
}
Operation describes arguments which are used to configure how a Bogform operation such as a plan or apply executes.
func BindOperation ¶
func BindOperation(cli *CommandLine) *Operation
bind registers all Operation flags
type Output ¶
type Output struct {
// Name identifies which root module output to show. If empty, show all
// outputs.
Name string
// View represents the global view options
View *View
// Vars and State are the common extended flags
Vars *Vars
State *State
}
Output represents the command-line arguments for the output command.
func BindOutput ¶
func BindOutput(cli *CommandLine) *Output
BindOutput registers CLI arguments, returning a Output value and it's corresponding hooks.
func ParseOutput ¶
func ParseOutput(args []string) (*Output, func(), tfdiags.Diagnostics)
ParseOutput processes CLI arguments, returning an Output value, a closer function, and errors. If errors are encountered, an Output value is still returned representing the best effort interpretation of the arguments.
type Plan ¶
type Plan struct {
// State, Operation, and Vars are the common extended flags
State *State
Operation *Operation
Vars *Vars
// DetailedExitCode enables different exit codes for error, success with
// changes, and success with no changes.
DetailedExitCode bool
// OutPath contains an optional path to store the plan file
OutPath string
// GenerateConfigPath tells Bogform that config should be generated for
// unmatched import target paths and which path the generated file should
// be written to.
GenerateConfigPath string
// View represents the global view options
View *View
}
Plan represents the command-line arguments for the plan command.
func BindPlan ¶
func BindPlan(cli *CommandLine) *Plan
BindPlan registers CLI arguments, returning a Plan value and it's corresponding hooks.
type Providers ¶
type Providers struct {
// TestsDirectory indicates the path where the tests are stored
TestsDirectory string
// Vars holds and provides information for the flags related to variables that a user can give into the process
Vars *Vars
// View represents the global view options
View *View
}
Providers represents the command-line arguments for the providers command.
func BindProviders ¶
func BindProviders(cli *CommandLine) *Providers
BindProviders registers CLI arguments, returning a Providers value and it's corresponding hooks.
func ParseProviders ¶
func ParseProviders(args []string) (*Providers, func(), tfdiags.Diagnostics)
ParseProviders processes CLI arguments, returning a Providers value, a closer function, and errors. If errors are encountered, a Providers value is still returned representing the best effort interpretation of the arguments.
type ProvidersLock ¶
type ProvidersLock struct {
// Providers are the source addresses of the providers that are requested to be updated
Providers []string
// OptPlatforms contains the platforms that the user requested for the locks to be updated for.
// Having this empty, only the checksum for the host platform will be updated, but the user
// can use this to update the hashes for other platforms too.
OptPlatforms []string
// FsMirrorDir represents a path from where Bogform should check for providers instead to reach
// out for the registry.
FsMirrorDir string
// NetMirrorURL represents a URL to a mirrored registry from where Bogform should check for
// providers instead to reach out for the registry.
NetMirrorURL string
// OciMirrorTemplate represents a URI-style template string that evaluates to an OCI repository address
// to use for the providers.
OciMirrorTemplate string
// View represents the global view options
View *View
// Vars holds and provides information for the flags related to variables that a user can give into the process
Vars *Vars
}
ProvidersLock represents the command-line arguments for the 'providers lock' command.
func BindProvidersLock ¶
func BindProvidersLock(cli *CommandLine) *ProvidersLock
BindProvidersLock registers CLI arguments, returning a ProvidersLock value and it's corresponding hooks.
func ParseProvidersLock ¶
func ParseProvidersLock(args []string) (*ProvidersLock, func(), tfdiags.Diagnostics)
ParseProvidersLock processes CLI arguments, returning a ProvidersLock value, a closer function, and errors. If errors are encountered, a ProvidersLock value is still returned representing the best effort interpretation of the arguments.
type ProvidersMirror ¶
type ProvidersMirror struct {
// Directory is the directory where the copies of the providers will be stored
Directory string
// OptPlatforms contains the platforms that the user requested to have the providers
// copy for
OptPlatforms []string
// View represents the global view options
View *View
// Vars holds and provides information for the flags related to variables that a user can give into the process
Vars *Vars
}
ProvidersMirror represents the command-line arguments for the 'providers lock' command.
func BindProvidersMirror ¶
func BindProvidersMirror(cli *CommandLine) *ProvidersMirror
BindProvidersMirror registers CLI arguments, returning a ProvidersMirror value and it's corresponding hooks.
func ParseProvidersMirror ¶
func ParseProvidersMirror(args []string) (*ProvidersMirror, func(), tfdiags.Diagnostics)
ParseProvidersMirror processes CLI arguments, returning a ProvidersMirror value, a closer function, and errors. If errors are encountered, a ProvidersMirror value is still returned representing the best effort interpretation of the arguments.
type ProvidersSchema ¶
type ProvidersSchema struct {
// View represents the global view options
View *View
// Vars holds and provides information for the flags related to variables that a user can give into the process
Vars *Vars
}
ProvidersSchema represents the command-line arguments for the 'providers schema' command.
func BindProvidersSchema ¶
func BindProvidersSchema(cli *CommandLine) *ProvidersSchema
BindProvidersSchema registers CLI arguments, returning a ProvidersSchema value and it's corresponding hooks.
func ParseProvidersSchema ¶
func ParseProvidersSchema(args []string) (*ProvidersSchema, func(), tfdiags.Diagnostics)
ParseProvidersSchema processes CLI arguments, returning a ProvidersSchema value, a closer function, and errors. If errors are encountered, a ProvidersSchema value is still returned representing the best effort interpretation of the arguments.
type Refresh ¶
type Refresh struct {
// State, Operation, and Vars are the common extended flags
State *State
Operation *Operation
Vars *Vars
// View represents the global view options
View *View
}
Refresh represents the command-line arguments for the apply command.
func BindRefresh ¶
func BindRefresh(cli *CommandLine) *Refresh
BindRefresh registers CLI arguments, returning a Refresh value and it's corresponding hooks.
func ParseRefresh ¶
func ParseRefresh(args []string) (*Refresh, func(), tfdiags.Diagnostics)
ParseRefresh processes CLI arguments, returning a Refresh value, a closer function, and errors. If errors are encountered, a Refresh value is still returned representing the best effort interpretation of the arguments.
type Show ¶
type Show struct {
// TargetType and TargetArg together describe the object that was
// requested to be shown.
//
// The meaning of TargetArg varies depending on TargetType. Refer to
// the documentation for each [ShowTargetType] constant for details.
TargetType ShowTargetType
TargetArg string
// View represents the global view options
View *View
Vars *Vars
}
Show represents the command-line arguments for the show command.
func BindShow ¶
func BindShow(cli *CommandLine) *Show
BindShow registers CLI arguments, returning a Show value and it's corresponding hooks.
type ShowTargetType ¶
type ShowTargetType int
ShowTargetType represents the type of object that is requested to be shown by the "bogform show" command.
const ( // ShowUnknownType is the zero value of [ShowTargetType], and represents // that the target type is ambiguous and so must be inferred by the // caller based on the [Show.TargetArg] value. ShowUnknownType ShowTargetType = iota // ShowState represents a request to show the latest state snapshot. // // This target type does not use [Show.TargetArg]. ShowState // ShowPlan represents a request to show a plan loaded from a saved // plan file. // // For this target type, [Show.TargetArg] is the plan file to load. ShowPlan // ShowConfig represents a request to show the current configuration. // // This target type does not use [Show.TargetArg]. ShowConfig // ShowModule represents a request to show just one module in isolation, // without requiring any of its dependencies to be installed. // // For this target type, [Show.TargetArg] is a path to the directory // containing the module. ShowModule )
func (ShowTargetType) String ¶
func (i ShowTargetType) String() string
type State ¶
type State struct {
// Lock controls whether or not the state manager is used to lock state
// during operations.
Lock bool
// LockTimeout allows setting a time limit on acquiring the state lock.
// The default is 0, meaning no limit.
LockTimeout time.Duration
// StatePath specifies a non-default location for the state file. The
// default value is blank, which is interpreted as "terraform.tfstate".
// Represents the local path where state is read from.
StatePath string
// StateOutPath specifies a different path to write the final state file.
// The default value is blank, which results in state being written back to
// StatePath.
StateOutPath string
// BackupPath specifies the path where a backup copy of the state file will
// be stored before the new state is written. The default value is blank,
// which is interpreted as StateOutPath + ".backup" or, in some cases, the backup
// is skipped altogether.
BackupPath string
}
State describes arguments which are used to define how Bogform interacts with state.
func BindState ¶
func BindState(cli *CommandLine, mask stateFlag) *State
bind is the sole logic of registering the state related flags in Bogform.
type StateHistory ¶
type StateHistory struct {
// Workspace overrides the selected workspace.
Workspace string
// Limit is the most versions to list. Zero or less lists them all.
Limit int
// JSON prints the versions as JSON.
JSON bool
View *View
Vars *Vars
Backend *Backend
}
StateHistory represents the command-line arguments for the 'state history' command.
func BindStateHistory ¶
func BindStateHistory(cli *CommandLine) *StateHistory
BindStateHistory registers the CLI arguments for 'state history'.
type StateList ¶
type StateList struct {
// LookupId restricts output to paths with a resource having the specified ID.
LookupId string
// InstancesRawAddr is a list of raw addresses of the resources that are requested
// to be listed.
InstancesRawAddr []string
// View represents the global view options
View *View
// Vars and State are the common extended flags
Vars *Vars
State *State
}
StateList represents the command-line arguments for the 'state list' command.
func BindStateList ¶
func BindStateList(cli *CommandLine) *StateList
BindStateList registers CLI arguments, returning a StateList value and it's corresponding hooks.
func ParseStateList ¶
func ParseStateList(args []string) (*StateList, func(), tfdiags.Diagnostics)
ParseStateList processes CLI arguments, returning a StateList value, a closer function, and errors. If errors are encountered, a StateList value is still returned representing the best effort interpretation of the arguments.
type StateMv ¶
type StateMv struct {
// RawSrcAddr represents a resources address that is requested by the user to be moved
RawSrcAddr string
// RawDestAddr represents a resources address that is requested by the user to be used to move the
// resource into
RawDestAddr string
// DryRun just validates that the arguments provided are valid and will output the possible outcome.
// When running in this mode, the state will suffer no change.
DryRun bool
// BackupPathOut can be used by the user to configure where to save the backup file of the state file.
BackupPathOut string
// View represents the global view options
View *View
// Vars, Backend and State are the common extended flags
Vars *Vars
Backend *Backend
State *State
}
StateMv represents the command-line arguments for the 'state mv' command.
func BindStateMv ¶
func BindStateMv(cli *CommandLine) *StateMv
BindStateMv registers CLI arguments, returning a StateMv value and it's corresponding hooks.
func ParseStateMv ¶
func ParseStateMv(args []string) (*StateMv, func(), tfdiags.Diagnostics)
ParseStateMv processes CLI arguments, returning a StateMv value, a closer function, and errors. If errors are encountered, a StateMv value is still returned representing the best effort interpretation of the arguments.
type StatePassphrase ¶
type StatePassphrase struct {
// Name is the keychain entry's name, as the passphrase key provider's "keychain" attribute gives it.
Name string
View *View
}
StatePassphrase represents the command-line arguments for 'state passphrase set' and 'delete'.
func BindStatePassphrase ¶
func BindStatePassphrase(cli *CommandLine) *StatePassphrase
BindStatePassphrase registers the CLI arguments for the passphrase commands.
type StatePull ¶
type StatePull struct {
// View represents the global view options
View *View
// Vars are the common extended flags
Vars *Vars
}
StatePull represents the command-line arguments for the 'state pull' command.
func BindStatePull ¶
func BindStatePull(cli *CommandLine) *StatePull
BindStatePull registers CLI arguments, returning a StatePull value and it's corresponding hooks.
func ParseStatePull ¶
func ParseStatePull(args []string) (*StatePull, func(), tfdiags.Diagnostics)
ParseStatePull processes CLI arguments, returning a StatePull value, a closer function, and errors. If errors are encountered, a StatePull value is still returned representing the best effort interpretation of the arguments.
type StatePush ¶
type StatePush struct {
// StateSrc represents the source of the state that wants to be pushed.
// This can be a file name/file path, or it can be "-" when the state should be read from [os.Stdin].
StateSrc string
// Force will try to forcefully push the state remotely. This will happen only if the backend supports it.
Force bool
// View represents the global view options
View *View
// Vars, Backend and State are the common extended flags
Vars *Vars
Backend *Backend
State *State
}
StatePush represents the command-line arguments for the 'state push' command.
func BindStatePush ¶
func BindStatePush(cli *CommandLine) *StatePush
BindStatePush registers CLI arguments, returning a StatePush value and it's corresponding hooks.
func ParseStatePush ¶
func ParseStatePush(args []string) (*StatePush, func(), tfdiags.Diagnostics)
ParseStatePush processes CLI arguments, returning a StatePush value, a closer function, and errors. If errors are encountered, a StatePush value is still returned representing the best effort interpretation of the arguments.
type StateRekey ¶
type StateRekey struct {
// Workspace limits the rekey to one workspace. Empty means all of them.
Workspace string
View *View
Vars *Vars
Backend *Backend
State *State
}
StateRekey represents the command-line arguments for the 'state rekey' command.
func BindStateRekey ¶
func BindStateRekey(cli *CommandLine) *StateRekey
BindStateRekey registers the CLI arguments for 'state rekey'.
type StateReplaceProvider ¶
type StateReplaceProvider struct {
// RawSrcAddr represents a provider address that is requested by the user to be moved
RawSrcAddr string
// RawDestAddr represents a provider address that is requested by the user to be used to move the
// provider into
RawDestAddr string
// AutoApprove is an option that the user can configure to skip the confirmation step of the replacement
// process.
AutoApprove bool
// View represents the global view options
View *View
// Vars, Backend and State are the common extended flags
Vars *Vars
Backend *Backend
State *State
}
StateReplaceProvider represents the command-line arguments for the 'state replace-provider' command.
func BindStateReplaceProvider ¶
func BindStateReplaceProvider(cli *CommandLine) *StateReplaceProvider
BindStateReplaceProvider registers CLI arguments, returning a StateReplaceProvider value and it's corresponding hooks.
func ParseReplaceProvider ¶
func ParseReplaceProvider(args []string) (*StateReplaceProvider, func(), tfdiags.Diagnostics)
ParseReplaceProvider processes CLI arguments, returning a StateReplaceProvider value, a closer function, and errors. If errors are encountered, a StateReplaceProvider value is still returned representing the best effort interpretation of the arguments.
type StateRestore ¶
type StateRestore struct {
// Version is the ID of the version to restore, as 'state history' lists it.
Version string
// Workspace overrides the selected workspace.
Workspace string
// AutoApprove skips the confirmation.
AutoApprove bool
// Force allows restoring a state with a different lineage.
Force bool
View *View
Vars *Vars
Backend *Backend
State *State
}
StateRestore represents the command-line arguments for the 'state restore' command.
func BindStateRestore ¶
func BindStateRestore(cli *CommandLine) *StateRestore
BindStateRestore registers the CLI arguments for 'state restore'.
func ParseStateRestore ¶
func ParseStateRestore(args []string) (*StateRestore, func(), tfdiags.Diagnostics)
ParseStateRestore processes CLI arguments for 'state restore'. It's used by tests.
type StateRm ¶
type StateRm struct {
// TargetAddrs represents the raw resource addresses to be removed from the state
TargetAddrs []string
// DryRun just validates that the arguments provided are valid and will output the possible outcome.
// When running in this mode, the state will suffer no change.
DryRun bool
// View represents the global view options
View *View
// Vars, Backend and State are the common extended flags
Vars *Vars
Backend *Backend
State *State
}
StateRm represents the command-line arguments for the 'state rm' command.
func BindStateRm ¶
func BindStateRm(cli *CommandLine) *StateRm
BindStateRm registers CLI arguments, returning a StateRm value and it's corresponding hooks.
func ParseStateRm ¶
func ParseStateRm(args []string) (*StateRm, func(), tfdiags.Diagnostics)
ParseStateRm processes CLI arguments, returning a StateRm value, a closer function, and errors. If errors are encountered, a StateRm value is still returned representing the best effort interpretation of the arguments.
type StateShow ¶
type StateShow struct {
// TargetRawAddr represents the raw resource address of the resource requested to have the state shown for.
TargetRawAddr string
// View represents the global view options
View *View
// Vars and State are the common extended flags
Vars *Vars
State *State
}
StateShow represents the command-line arguments for the 'state show' command.
func BindStateShow ¶
func BindStateShow(cli *CommandLine) *StateShow
BindStateShow registers CLI arguments, returning a StateShow value and it's corresponding hooks.
func ParseStateShow ¶
func ParseStateShow(args []string) (*StateShow, func(), tfdiags.Diagnostics)
ParseStateShow processes CLI arguments, returning a StateShow value, a closer function, and errors. If errors are encountered, a StateShow value is still returned representing the best effort interpretation of the arguments.
type Taint ¶
type Taint struct {
// TargetAddress is the resource address that is requested to be marked as tainted.
TargetAddress addrs.AbsResourceInstance
// AllowMissing can be set to "true" to write a warning instead of an error and to return exit code 0
// when the TargetAddress points to a missing resource.
AllowMissing bool
// View represents the global view options
View *View
// Vars holds and provides information for the flags related to variables that a user can give into the process
Vars *Vars
// State is used for the state related flags
State *State
// Backend is used strictly for the ignore remote version flag
Backend *Backend
}
Taint represents the command-line arguments for the taint and untaint commands.
func BindTaint ¶
func BindTaint(cli *CommandLine, isTaint bool) *Taint
BindTaint registers CLI arguments, returning a Taint value and it's corresponding hooks.
func ParseTaint ¶
func ParseTaint(isTaint bool, args []string) (*Taint, func(), tfdiags.Diagnostics)
ParseTaint processes CLI arguments, returning a Taint value, a closer function, and errors. If errors are encountered, a Taint value is still returned representing the best effort interpretation of the arguments.
type Test ¶
type Test struct {
// Filter contains a list of test files to execute. If empty, all test files
// will be executed.
Filter []string
// TestDirectory allows the user to override the directory that the test
// command will use to discover test files, defaults to "tests". Regardless
// of the value here, test files within the configuration directory will
// always be discovered.
TestDirectory string
// View represents the global view options
View *View
// You can specify common variables for all tests from the command line.
Vars *Vars
// Verbose tells the test command to print out the plan either in
// human-readable format or JSON for each run step depending on the
// ViewType.
Verbose bool
}
Test represents the command-line arguments for the test command.
func BindTest ¶
func BindTest(cli *CommandLine) *Test
BindTest registers CLI arguments, returning a Test value and it's corresponding hooks.
type Unlock ¶
type Unlock struct {
// LockID is the ID of the lock that the user has to provide.
LockID string
// Force disables the confirmation prompt
Force bool
// Vars holds and provides information for the flags related to variables that a user can give into the process
Vars *Vars
// View represents the global view options
View *View
}
Unlock represents the command-line arguments for the unlock command.
func BindUnlock ¶
func BindUnlock(cli *CommandLine) *Unlock
BindUnlock registers CLI arguments, returning a Unlock value and it's corresponding hooks.
func ParseUnlock ¶
func ParseUnlock(args []string) (*Unlock, func(), tfdiags.Diagnostics)
ParseUnlock processes CLI arguments, returning a Unlock value, a closer function, and errors. If errors are encountered, a Unlock value is still returned representing the best effort interpretation of the arguments.
type Validate ¶
type Validate struct {
// Path is the directory containing the configuration to be validated. If
// unspecified, validate will use the current directory.
Path string
// TestDirectory is the directory containing any test files that should be
// validated alongside the main configuration. Should be relative to the
// Path.
TestDirectory string
// NoTests indicates that Bogform should not validate any test files
// included with the module.
NoTests bool
// View represents the global view options
View *View
Vars *Vars
}
Validate represents the command-line arguments for the validate command.
func BindValidate ¶
func BindValidate(cli *CommandLine) *Validate
BindValidate registers CLI arguments, returning a Validate value and it's corresponding hooks.
func ParseValidate ¶
func ParseValidate(args []string) (*Validate, func(), tfdiags.Diagnostics)
ParseValidate processes CLI arguments, returning a Validate value, a closer function, and errors. If errors are encountered, a Validate value is still returned representing the best effort interpretation of the arguments.
type Vars ¶
Vars describes arguments which specify non-default variable values. This interface is unfortunately obscure, because the order of the CLI arguments determines the final value of the gathered variables. In future it might be desirable for the arguments package to handle the gathering of variables directly, returning a map of variable values.
type Version ¶
type Version struct {
// View represents the global view options
View *View
}
Version represents the command-line arguments for the version command.
func BindVersion ¶
func BindVersion(cli *CommandLine) *Version
BindVersion registers CLI arguments, returning a Version value and it's corresponding hooks.
func ParseVersion ¶
func ParseVersion(args []string) (*Version, func(), tfdiags.Diagnostics)
ParseVersion processes CLI arguments, returning a Version value, a closer function, and errors. If errors are encountered, a Version value is still returned representing the best effort interpretation of the arguments.
type View ¶
type View struct {
// NoColor is used to disable the use of terminal color codes in all
// output.
NoColor bool
// CompactWarnings is used to coalesce duplicate warnings, to reduce the
// level of noise when multiple instances of the same warning are raised
// for a configuration.
CompactWarnings bool
ConsolidateWarnings bool
ConsolidateErrors bool
// LintInclude and LintExclude contains the linting rules that are used later
// to determine if a specific diagnostic should be shown or not based on the
// linting rule IDs (or/and groupIDs) that diagnostic is configured with.
LintInclude, LintExclude collections.Set[linting.RuleAddr]
// Concise is used to reduce the level of noise in the output and display
// only the important details.
Concise bool
// ModuleDeprecationWarnLvl is used to filter out deprecation warnings for outputs and variables as requested by the user.
ModuleDeprecationWarnLvl DeprecationWarningLevel
// ShowSensitive is used to display the value of variables marked as sensitive.
ShowSensitive bool
// ViewType specifies which output format to use
ViewType ViewType
// InputEnabled is used to disable interactive input for unspecified
// variable and backend config values. Default is true.
InputEnabled bool
// Optional stream to write json data to
JSONInto *os.File
}
View represents the global command-line arguments which configure the view.
func BindView ¶
func BindView(cli *CommandLine, mask viewFlag) *View
type ViewType ¶
type ViewType rune
ViewType represents which view layer to use for a given command. Not all commands will support all view types, and validation that the type is supported should happen in the view constructor.
type Workspace ¶
type Workspace struct {
// View represents the global view options
View *View
}
func BindWorkspace ¶
func BindWorkspace(cli *CommandLine) *Workspace
BindWorkspace registers CLI arguments, returning a Workspace value and it's corresponding hooks.
func ParseWorkspace ¶
func ParseWorkspace(args []string) (*Workspace, func(), tfdiags.Diagnostics)
type WorkspaceDelete ¶
type WorkspaceDelete struct {
// WorkspaceName represents the name of the workspace that the user wants to be selected.
WorkspaceName string
// Force allows the user to forcefully delete a workspace removing the still existing resources
// from the Bogform's management.
Force bool
// View represents the global view options
View *View
// Vars and State are the common extended flags
Vars *Vars
State *State
}
func BindWorkspaceDelete ¶
func BindWorkspaceDelete(cli *CommandLine) *WorkspaceDelete
BindWorkspaceDelete registers CLI arguments, returning a WorkspaceDelete value and it's corresponding hooks.
func ParseWorkspaceDelete ¶
func ParseWorkspaceDelete(args []string) (*WorkspaceDelete, func(), tfdiags.Diagnostics)
type WorkspaceList ¶
type WorkspaceList struct {
// View represents the global view options
View *View
// Vars holds the information that might be needed to be given through `-var`/`-var-file`.
Vars *Vars
}
func BindWorkspaceList ¶
func BindWorkspaceList(cli *CommandLine) *WorkspaceList
BindWorkspaceList registers CLI arguments, returning a WorkspaceList value and it's corresponding hooks.
func ParseWorkspaceList ¶
func ParseWorkspaceList(args []string) (*WorkspaceList, func(), tfdiags.Diagnostics)
type WorkspaceNew ¶
type WorkspaceNew struct {
// Workspace represents the name of the workspace that the user wants to be selected.
WorkspaceName string
// View represents the global view options
View *View
// Vars and State are the common extended flags
Vars *Vars
State *State
}
func BindWorkspaceNew ¶
func BindWorkspaceNew(cli *CommandLine) *WorkspaceNew
BindWorkspaceNew registers CLI arguments, returning a WorkspaceNew value and it's corresponding hooks.
func ParseWorkspaceNew ¶
func ParseWorkspaceNew(args []string) (*WorkspaceNew, func(), tfdiags.Diagnostics)
type WorkspaceSelect ¶
type WorkspaceSelect struct {
// Workspace represents the name of the workspace that the user wants to be selected.
WorkspaceName string
// CreateIfMissing is a flag that the user can set to "true" to force the creation of the workspace
// in case it's missing from the current list of workspaces.
CreateIfMissing bool
// View represents the global view options
View *View
// Vars holds the information that might be needed to be given through `-var`/`-var-file`.
Vars *Vars
}
func BindWorkspaceSelect ¶
func BindWorkspaceSelect(cli *CommandLine) *WorkspaceSelect
BindWorkspaceSelect registers CLI arguments, returning a WorkspaceSelect value and it's corresponding hooks.
func ParseWorkspaceSelect ¶
func ParseWorkspaceSelect(args []string) (*WorkspaceSelect, func(), tfdiags.Diagnostics)
type WorkspaceShow ¶
type WorkspaceShow struct {
// View represents the global view options
View *View
// Vars holds the information that might be needed to be given through `-var`/`-var-file`.
Vars *Vars
}
func BindWorkspaceShow ¶
func BindWorkspaceShow(cli *CommandLine) *WorkspaceShow
BindWorkspaceShow registers CLI arguments, returning a WorkspaceShow value and it's corresponding hooks.
func ParseWorkspaceShow ¶
func ParseWorkspaceShow(args []string) (*WorkspaceShow, func(), tfdiags.Diagnostics)
Source Files
¶
- apply.go
- arguments.go
- backend.go
- common.go
- console.go
- deprecation_level.go
- deprecationwarninglevel_string.go
- extended.go
- fmt.go
- get.go
- graph.go
- import.go
- init.go
- lint.go
- login.go
- logout.go
- metadata_functions.go
- migrate.go
- output.go
- plan.go
- providers.go
- providers_lock.go
- providers_mirror.go
- providers_schema.go
- refresh.go
- show.go
- showtargettype_string.go
- state_history.go
- state_list.go
- state_mv.go
- state_pull.go
- state_push.go
- state_replace_provider.go
- state_rm.go
- state_show.go
- taint.go
- test.go
- unlock.go
- validate.go
- version.go
- view.go
- workspace.go
- workspace_delete.go
- workspace_list.go
- workspace_new.go
- workspace_select.go
- workspace_show.go