Documentation
¶
Index ¶
- Constants
- func OpenJSONIntoFile(jsonIntoFlag string) (*os.File, func(), tfdiags.Diagnostics)
- type Apply
- type Backend
- type Get
- type Init
- type Login
- type Logout
- type Operation
- type Output
- type Plan
- type Refresh
- type Show
- type ShowTargetType
- type State
- type Test
- type Validate
- type Vars
- type View
- type ViewOptions
- type ViewType
Constants ¶
const DefaultParallelism = 10
DefaultParallelism is the limit Ghoten places on total parallel operations as it walks the dependency graph.
Variables ¶
This section is empty.
Functions ¶
func OpenJSONIntoFile ¶
func OpenJSONIntoFile(jsonIntoFlag string) (*os.File, func(), tfdiags.Diagnostics)
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
// ViewOptions specifies which view options to use
ViewOptions ViewOptions
// ShowSensitive is used to display the value of variables marked as sensitive.
ShowSensitive bool
// 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 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 "ghoten destroy" command, which is effectively an alias for "ghoten apply -destroy".
type Backend ¶
type Backend struct {
IgnoreRemoteVersion bool
// StateLock indicates if the state should be locked or not.
StateLock bool
// StateLockTimeout configures the duration that it waits for the state lock to be acquired.
StateLockTimeout time.Duration
// ForceInitCopy controls if the prompts for state migration should be skipped or not.
ForceInitCopy bool
// Reconfigure controls if the reconfiguration of the backend should happen with discarding the old configurations.
Reconfigure bool
// MigrateState controls if during the reconfiguration of the backend a migration should be attempted.
MigrateState bool
}
func (*Backend) AddIgnoreRemoteVersionFlag ¶
func (*Backend) AddMigrationFlags ¶
func (*Backend) AddStateFlags ¶
type Get ¶
type Get struct {
Update bool
TestsDirectory string
Vars *Vars
ViewOptions ViewOptions
}
Get represents the command-line arguments for the get command.
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 Ghoten 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 flags.FlagStringSlice
// 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 flags.RawFlags
// Disable backend or cloud 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
// ViewOptions specifies which view options to use
ViewOptions ViewOptions
// 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
}
Init represents the command-line arguments for the init command.
type Login ¶
type Login struct {
Host string
// ViewOptions specifies which view options to use
ViewOptions ViewOptions
// Vars holds and provides information for the flags related to variables that a user can give into the process
Vars *Vars
}
Login represents the command-line arguments for the login command.
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 string
// ViewOptions specifies which view options to use
ViewOptions ViewOptions
// Vars holds and provides information for the flags related to variables that a user can give into the process
Vars *Vars
}
Logout represents the command-line arguments for the logout command.
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 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 Ghoten 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 Ghoten 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
// contains filtered or unexported fields
}
Operation describes arguments which are used to configure how a Ghoten operation such as a plan or apply executes.
func (*Operation) Parse ¶
func (o *Operation) Parse() tfdiags.Diagnostics
Parse must be called on Operation after initial flag parse. This processes the raw target flags into addrs.Targetable values, returning diagnostics if invalid.
type Output ¶
type Output struct {
// Name identifies which root module output to show. If empty, show all
// outputs.
Name string
// StatePath is an optional path to a state file, from which outputs will
// be loaded.
StatePath string
// ViewOptions specifies which view options to use
ViewOptions ViewOptions
Vars *Vars
// ShowSensitive is used to display the value of variables marked as sensitive.
ShowSensitive bool
}
Output represents the command-line arguments for the output command.
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 Ghoten that config should be generated for
// unmatched import target paths and which path the generated file should
// be written to.
GenerateConfigPath string
// ViewOptions specifies which view options to use
ViewOptions ViewOptions
// ShowSensitive is used to display the value of variables marked as sensitive.
ShowSensitive bool
}
Plan represents the command-line arguments for the plan command.
type Refresh ¶
type Refresh struct {
// State, Operation, and Vars are the common extended flags
State *State
Operation *Operation
Vars *Vars
// ViewOptions specifies which view options to use
ViewOptions ViewOptions
}
Refresh represents the command-line arguments for the apply command.
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
// ViewOptions specifies which view options to use
ViewOptions ViewOptions
Vars *Vars
// ShowSensitive is used to display the value of variables marked as sensitive.
ShowSensitive bool
}
Show represents the command-line arguments for the show command.
type ShowTargetType ¶
type ShowTargetType int
ShowTargetType represents the type of object that is requested to be shown by the "ghoten 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".
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".
BackupPath string
}
State describes arguments which are used to define how Ghoten interacts with state.
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
// ViewOptions specifies which view options to use
ViewOptions ViewOptions
// 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.
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 Ghoten should not validate any test files
// included with the module.
NoTests bool
// ViewOptions specifies which view options to use
ViewOptions ViewOptions
Vars *Vars
}
Validate represents the command-line arguments for the validate command.
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 ¶
type Vars struct {
// contains filtered or unexported fields
}
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 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
// 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 ghoten.DeprecationWarningLevel
// ShowSensitive is used to display the value of variables marked as sensitive.
ShowSensitive bool
}
View represents the global command-line arguments which configure the view.
type ViewOptions ¶
type ViewOptions struct {
// 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
// contains filtered or unexported fields
}
ViewOptions contains all of the information nessesary for constructing a view from raw CLI arguments. This replaced most of the direct usage of ViewType when the -json-into flag was introduced. In practice, this allows a much more nuanced set of data to be presented to the view constructors.
func (*ViewOptions) Parse ¶
func (v *ViewOptions) Parse() (func(), tfdiags.Diagnostics)