command

package
Version: v0.15.3 Latest Latest
Warning

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

Go to latest
Published: May 6, 2021 License: MPL-2.0 Imports: 106 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultBackupExtension = ".backup"

DefaultBackupExtension is added to the state file to form the path

View Source
const DefaultDataDir = ".terraform"

DefaultDataDir is the default directory for storing local data.

View Source
const DefaultParallelism = 10

DefaultParallelism is the limit Terraform places on total parallel operations as it walks the dependency graph.

View Source
const DefaultPluginVendorDir = "terraform.d/plugins/" + pluginMachineName

DefaultPluginVendorDir is the location in the config directory to look for user-added plugin binaries. Terraform only reads from this path if it exists, it is never created by terraform.

View Source
const DefaultStateFilename = "terraform.tfstate"

DefaultStateFilename is the default filename used for the state file.

View Source
const DefaultVarsFilename = "terraform.tfvars"

DefaultVarsFilename is the default filename used for vars

View Source
const ErrUnsupportedLocalOp = `` /* 290-byte string literal not displayed */

ErrUnsupportedLocalOp is the common error message shown for operations that require a backend.Local.

View Source
const (
	// InputModeEnvVar is the environment variable that, if set to "false" or
	// "0", causes terraform commands to behave as if the `-input=false` flag was
	// specified.
	InputModeEnvVar = "TF_INPUT"
)
View Source
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.

View Source
const VarEnvPrefix = "TF_VAR_"

VarEnvPrefix is the prefix for environment variables that represent values for root module input variables.

View Source
const WorkspaceNameEnvVar = "TF_WORKSPACE"

WorkspaceNameEnvVar is the name of the environment variable that can be used to set the name of the Terraform workspace, overriding the workspace chosen by `terraform workspace select`.

Note that this environment variable is ignored by `terraform workspace new` and `terraform workspace delete`.

Variables

This section is empty.

Functions

func ModulePath added in v0.9.0

func ModulePath(args []string) (string, error)

ModulePath returns the path to the root module and validates CLI arguments.

This centralizes the logic for any commands that previously accepted a module path via CLI arguments. This will error if any extraneous arguments are given and suggest using the -chdir flag instead.

If your command accepts more than one arg, then change the slice bounds to pass validation.

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 Terraform configuration and actually builds or changes infrastructure.

func (*ApplyCommand) GatherVariables added in v0.15.0

func (c *ApplyCommand) GatherVariables(opReq *backend.Operation, args *arguments.Vars) tfdiags.Diagnostics

func (*ApplyCommand) Help

func (c *ApplyCommand) Help() string

func (*ApplyCommand) LoadPlanFile added in v0.15.0

func (c *ApplyCommand) LoadPlanFile(path string) (*planfile.Reader, tfdiags.Diagnostics)

func (*ApplyCommand) OperationRequest added in v0.15.0

func (c *ApplyCommand) OperationRequest(
	be backend.Enhanced,
	view views.Apply,
	planFile *planfile.Reader,
	args *arguments.Operation,
	autoApprove bool,
) (*backend.Operation, tfdiags.Diagnostics)

func (*ApplyCommand) PrepareBackend added in v0.15.0

func (c *ApplyCommand) PrepareBackend(planFile *planfile.Reader, args *arguments.State) (backend.Enhanced, tfdiags.Diagnostics)

func (*ApplyCommand) Run

func (c *ApplyCommand) Run(rawArgs []string) int

func (*ApplyCommand) Synopsis

func (c *ApplyCommand) Synopsis() string

type BackendOpts added in v0.9.0

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
}

BackendOpts are the options used to initialize a backend.Backend.

type ColorizeUi

type ColorizeUi struct {
	Colorize    *colorstring.Colorize
	OutputColor string
	InfoColor   string
	ErrorColor  string
	WarnColor   string
	Ui          cli.Ui
}

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

func (*ColorizeUi) Ask

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

func (*ColorizeUi) AskSecret added in v0.5.0

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

func (*ColorizeUi) Error

func (u *ColorizeUi) Error(message string)

func (*ColorizeUi) Info

func (u *ColorizeUi) Info(message string)

func (*ColorizeUi) Output

func (u *ColorizeUi) Output(message string)

func (*ColorizeUi) Warn added in v0.4.0

func (u *ColorizeUi) Warn(message string)

type ConsoleCommand added in v0.8.0

type ConsoleCommand struct {
	Meta
}

ConsoleCommand is a Command implementation that applies a Terraform configuration and actually builds or changes infrastructure.

func (*ConsoleCommand) Help added in v0.8.0

func (c *ConsoleCommand) Help() string

func (*ConsoleCommand) Run added in v0.8.0

func (c *ConsoleCommand) Run(args []string) int

func (*ConsoleCommand) Synopsis added in v0.8.0

func (c *ConsoleCommand) Synopsis() string

type FlagStringKV added in v0.7.0

type FlagStringKV map[string]string

FlagStringKV is a flag.Value implementation for parsing user variables from the command-line in the format of '-var key=value', where value is only ever a primitive.

func (*FlagStringKV) Set added in v0.7.0

func (v *FlagStringKV) Set(raw string) error

func (*FlagStringKV) String added in v0.7.0

func (v *FlagStringKV) String() string

type FlagStringSlice added in v0.4.0

type FlagStringSlice []string

FlagStringSlice is a flag.Value implementation for parsing targets from the command line, e.g. -target=aws_instance.foo -target=aws_vpc.bar

func (*FlagStringSlice) Set added in v0.4.0

func (v *FlagStringSlice) Set(raw string) error

func (*FlagStringSlice) String added in v0.4.0

func (v *FlagStringSlice) String() string

type FmtCommand added in v0.6.15

type FmtCommand struct {
	Meta
	// contains filtered or unexported fields
}

FmtCommand is a Command implementation that rewrites Terraform config files to a canonical format and style.

func (*FmtCommand) Help added in v0.6.15

func (c *FmtCommand) Help() string

func (*FmtCommand) Run added in v0.6.15

func (c *FmtCommand) Run(args []string) int

func (*FmtCommand) Synopsis added in v0.6.15

func (c *FmtCommand) Synopsis() string

type GetCommand added in v0.3.0

type GetCommand struct {
	Meta
}

GetCommand is a Command implementation that takes a Terraform configuration and downloads all the modules.

func (*GetCommand) Help added in v0.3.0

func (c *GetCommand) Help() string

func (*GetCommand) Run added in v0.3.0

func (c *GetCommand) Run(args []string) int

func (*GetCommand) Synopsis added in v0.3.0

func (c *GetCommand) Synopsis() string

type GraphCommand

type GraphCommand struct {
	Meta
}

GraphCommand is a Command implementation that takes a Terraform configuration and outputs the dependency tree in graphical form.

func (*GraphCommand) Help

func (c *GraphCommand) Help() string

func (*GraphCommand) Run

func (c *GraphCommand) Run(args []string) int

func (*GraphCommand) Synopsis

func (c *GraphCommand) Synopsis() string

type ImportCommand added in v0.7.0

type ImportCommand struct {
	Meta
}

ImportCommand is a cli.Command implementation that imports resources into the Terraform state.

func (*ImportCommand) Help added in v0.7.0

func (c *ImportCommand) Help() string

func (*ImportCommand) Run added in v0.7.0

func (c *ImportCommand) Run(args []string) int

func (*ImportCommand) Synopsis added in v0.7.0

func (c *ImportCommand) Synopsis() string

type InitCommand added in v0.3.0

type InitCommand struct {
	Meta
}

InitCommand is a Command implementation that takes a Terraform module and clones it to the working directory.

func (*InitCommand) AutocompleteArgs added in v0.10.7

func (c *InitCommand) AutocompleteArgs() complete.Predictor

func (*InitCommand) AutocompleteFlags added in v0.10.7

func (c *InitCommand) AutocompleteFlags() complete.Flags

func (*InitCommand) Help added in v0.3.0

func (c *InitCommand) Help() string

func (*InitCommand) Run added in v0.3.0

func (c *InitCommand) Run(args []string) int

func (*InitCommand) Synopsis added in v0.3.0

func (c *InitCommand) Synopsis() string

type LoginCommand added in v0.12.9

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.

func (*LoginCommand) Help added in v0.12.9

func (c *LoginCommand) Help() string

Help implements cli.Command.

func (*LoginCommand) Run added in v0.12.9

func (c *LoginCommand) Run(args []string) int

Run implements cli.Command.

func (*LoginCommand) Synopsis added in v0.12.9

func (c *LoginCommand) Synopsis() string

Synopsis implements cli.Command.

type LogoutCommand added in v0.12.21

type LogoutCommand struct {
	Meta
}

LogoutCommand is a Command implementation which removes stored credentials for a remote service host.

func (*LogoutCommand) Help added in v0.12.21

func (c *LogoutCommand) Help() string

Help implements cli.Command.

func (*LogoutCommand) Run added in v0.12.21

func (c *LogoutCommand) Run(args []string) int

Run implements cli.Command.

func (*LogoutCommand) Synopsis added in v0.12.21

func (c *LogoutCommand) Synopsis() string

Synopsis implements cli.Command.

type Meta

type Meta struct {

	// OriginalWorkingDir, if set, is the actual working directory where
	// Terraform was run from. This might not be the _actual_ current working
	// directory, because users can add the -chdir=... option to the beginning
	// of their command line to ask Terraform to switch.
	//
	// Most things should just use the current working directory in order to
	// respect the user's override, but we retain this for exceptional
	// situations where we need to refer back to the original working directory
	// for some reason.
	OriginalWorkingDir string

	// Streams tracks the raw Stdout, Stderr, and Stdin handles along with
	// some basic metadata about them, such as whether each is connected to
	// a terminal, how wide the possible terminal is, etc.
	//
	// For historical reasons this might not be set in unit test code, and
	// so functions working with this field must check if it's nil and
	// do some default behavior instead if so, rather than panicking.
	Streams *terminal.Streams

	View *views.View

	Color            bool     // True if output should be colored
	GlobalPluginDirs []string // Additional paths to search for plugins
	Ui               cli.Ui   // Ui for output

	// Services provides access to remote endpoint information for
	// "terraform-native' services running at a specific user-facing hostname.
	Services *disco.Disco

	// RunningInAutomation indicates that commands are being run by an
	// automated system rather than directly at a command prompt.
	//
	// This is a hint to various command routines that it may be confusing
	// to print out messages that suggest running specific follow-up
	// commands, since the user consuming the output will not be
	// in a position to run such commands.
	//
	// The intended use-case of this flag is when Terraform is running in
	// some sort of workflow orchestration tool which is abstracting away
	// the specific commands being run.
	RunningInAutomation bool

	// CLIConfigDir is the directory from which CLI configuration files were
	// read by the caller and the directory where any changes to CLI
	// configuration files by commands should be made.
	//
	// If this is empty then no configuration directory is available and
	// commands which require one cannot proceed.
	CLIConfigDir string

	// PluginCacheDir, if non-empty, enables caching of downloaded plugins
	// into the given directory.
	PluginCacheDir string

	// 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

	// OverrideDataDir, if non-empty, overrides the return value of the
	// DataDir method for situations where the local .terraform/ directory
	// is not suitable, e.g. because of a read-only filesystem.
	OverrideDataDir string

	// BrowserLauncher is used by commands that need to open a URL in a
	// web browser.
	BrowserLauncher webbrowser.Launcher

	// 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 Terraform, which Terraform should use but not worry about the
	// lifecycle of.
	//
	// This is essentially a more extreme version of ProviderDevOverrides where
	// Terraform doesn't even worry about how the provider server gets launched,
	// just trusting that someone else did it before running Terraform.
	UnmanagedProviders map[addrs.Provider]*plugin.ReattachConfig
	// contains filtered or unexported fields
}

Meta are the meta-options that are available on all or most commands.

func (*Meta) Backend added in v0.9.0

func (m *Meta) Backend(opts *BackendOpts) (backend.Enhanced, tfdiags.Diagnostics)

Backend initializes and returns the backend for this CLI session.

The backend is used to perform the actual Terraform operations. This abstraction enables easily sliding in new Terraform 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 "terraform init" command line, etc.

func (*Meta) BackendForPlan added in v0.12.0

func (m *Meta) BackendForPlan(settings plans.Backend) (backend.Enhanced, tfdiags.Diagnostics)

BackendForPlan 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) Colorize

func (m *Meta) Colorize() *colorstring.Colorize

Colorize returns the colorization structure for a command.

func (*Meta) DataDir added in v0.4.0

func (m *Meta) DataDir() string

DataDir returns the directory where local data will be stored. Defaults to DefaultDataDir in the current working directory.

func (*Meta) ErrorColumns added in v0.15.0

func (m *Meta) ErrorColumns() int

ErrorColumns returns the number of columns that error UI output should be wrapped to fill.

This is the column count to use if you'll be printing your message via the Error or Warn methods of m.Ui.

func (*Meta) Input added in v0.3.5

func (m *Meta) Input() bool

Input returns whether or not input asking is enabled.

func (*Meta) InputMode added in v0.3.0

func (m *Meta) InputMode() terraform.InputMode

InputMode returns the type of input we should ask for in the form of terraform.InputMode which is passed directly to Context.Input.

func (*Meta) InterruptibleContext added in v0.14.0

func (m *Meta) InterruptibleContext() (context.Context, context.CancelFunc)

InterruptibleContext returns a context.Context that will be cancelled if the process is interrupted by a platform-specific interrupt signal.

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.

func (*Meta) Operation added in v0.9.0

func (m *Meta) Operation(b backend.Backend) *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) OutputColumns added in v0.15.0

func (m *Meta) OutputColumns() int

OutputColumns returns the number of columns that normal (non-error) UI output should be wrapped to fill.

This is the column count to use if you'll be printing your message via the Output or Info methods of m.Ui.

func (*Meta) PlanFile added in v0.12.0

func (m *Meta) PlanFile(path string) (*planfile.Reader, error)

PlanFile returns a reader for the plan file at the given path.

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

func (m *Meta) RunOperation(b backend.Enhanced, opReq *backend.Operation) (*backend.RunningOperation, error)

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

func (m *Meta) SetWorkspace(name string) error

SetWorkspace saves the given name as the current workspace in the local filesystem.

func (*Meta) StateOutPath added in v0.3.5

func (m *Meta) StateOutPath() string

StateOutPath returns the true output path for the state file

func (*Meta) StdinPiped added in v0.8.0

func (m *Meta) StdinPiped() bool

StdinPiped returns true if the input is piped.

func (*Meta) UIInput added in v0.3.0

func (m *Meta) UIInput() terraform.UIInput

UIInput returns a UIInput object to be used for asking for input.

func (*Meta) Workspace added in v0.10.0

func (m *Meta) Workspace() (string, error)

Workspace returns the name of the currently configured workspace, corresponding to the desired named state.

func (*Meta) WorkspaceOverridden added in v0.10.0

func (m *Meta) WorkspaceOverridden() (string, bool)

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 OutputCommand

type OutputCommand struct {
	Meta
}

OutputCommand is a Command implementation that reads an output from a Terraform state and prints it.

func (*OutputCommand) Help

func (c *OutputCommand) Help() string

func (*OutputCommand) Outputs added in v0.15.0

func (c *OutputCommand) Outputs(statePath string) (map[string]*states.OutputValue, tfdiags.Diagnostics)

func (*OutputCommand) Run

func (c *OutputCommand) Run(rawArgs []string) int

func (*OutputCommand) Synopsis

func (c *OutputCommand) Synopsis() string

type PlanCommand

type PlanCommand struct {
	Meta
}

PlanCommand is a Command implementation that compares a Terraform configuration to an actual infrastructure and shows the differences.

func (*PlanCommand) GatherVariables added in v0.15.0

func (c *PlanCommand) GatherVariables(opReq *backend.Operation, args *arguments.Vars) tfdiags.Diagnostics

func (*PlanCommand) Help

func (c *PlanCommand) Help() string

func (*PlanCommand) OperationRequest added in v0.15.0

func (c *PlanCommand) OperationRequest(
	be backend.Enhanced,
	view views.Plan,
	args *arguments.Operation,
	planOutPath string,
) (*backend.Operation, tfdiags.Diagnostics)

func (*PlanCommand) PrepareBackend added in v0.15.0

func (c *PlanCommand) PrepareBackend(args *arguments.State) (backend.Enhanced, tfdiags.Diagnostics)

func (*PlanCommand) Run

func (c *PlanCommand) Run(rawArgs []string) int

func (*PlanCommand) Synopsis

func (c *PlanCommand) Synopsis() string

type ProvidersCommand added in v0.10.0

type ProvidersCommand struct {
	Meta
}

ProvidersCommand is a Command implementation that prints out information about the providers used in the current configuration/state.

func (*ProvidersCommand) Help added in v0.10.0

func (c *ProvidersCommand) Help() string

func (*ProvidersCommand) Run added in v0.10.0

func (c *ProvidersCommand) Run(args []string) int

func (*ProvidersCommand) Synopsis added in v0.10.0

func (c *ProvidersCommand) Synopsis() string

type ProvidersLockCommand added in v0.14.0

type ProvidersLockCommand struct {
	Meta
}

ProvidersLockCommand is a Command implementation that implements the "terraform 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) Help added in v0.14.0

func (c *ProvidersLockCommand) Help() string

func (*ProvidersLockCommand) Run added in v0.14.0

func (c *ProvidersLockCommand) Run(args []string) int

func (*ProvidersLockCommand) Synopsis added in v0.14.0

func (c *ProvidersLockCommand) Synopsis() string

type ProvidersMirrorCommand added in v0.13.0

type ProvidersMirrorCommand struct {
	Meta
}

ProvidersMirrorCommand is a Command implementation that implements the "terraform 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) Help added in v0.13.0

func (c *ProvidersMirrorCommand) Help() string

func (*ProvidersMirrorCommand) Run added in v0.13.0

func (c *ProvidersMirrorCommand) Run(args []string) int

func (*ProvidersMirrorCommand) Synopsis added in v0.13.0

func (c *ProvidersMirrorCommand) Synopsis() string

type ProvidersSchemaCommand added in v0.12.0

type ProvidersSchemaCommand struct {
	Meta
}

ProvidersCommand is a Command implementation that prints out information about the providers used in the current configuration/state.

func (*ProvidersSchemaCommand) Help added in v0.12.0

func (c *ProvidersSchemaCommand) Help() string

func (*ProvidersSchemaCommand) Run added in v0.12.0

func (c *ProvidersSchemaCommand) Run(args []string) int

func (*ProvidersSchemaCommand) Synopsis added in v0.12.0

func (c *ProvidersSchemaCommand) Synopsis() string

type PushCommand added in v0.3.5

type PushCommand struct {
	Meta
}

func (*PushCommand) Help added in v0.3.5

func (c *PushCommand) Help() string

func (*PushCommand) Run added in v0.3.5

func (c *PushCommand) Run(args []string) int

func (*PushCommand) Synopsis added in v0.3.5

func (c *PushCommand) Synopsis() string

type RefreshCommand

type RefreshCommand struct {
	Meta
}

RefreshCommand is a cli.Command implementation that refreshes the state file.

func (*RefreshCommand) GatherVariables added in v0.15.0

func (c *RefreshCommand) GatherVariables(opReq *backend.Operation, args *arguments.Vars) tfdiags.Diagnostics

func (*RefreshCommand) Help

func (c *RefreshCommand) Help() string

func (*RefreshCommand) OperationRequest added in v0.15.0

func (c *RefreshCommand) OperationRequest(be backend.Enhanced, view views.Refresh, args *arguments.Operation,
) (*backend.Operation, tfdiags.Diagnostics)

func (*RefreshCommand) PrepareBackend added in v0.15.0

func (c *RefreshCommand) PrepareBackend(args *arguments.State) (backend.Enhanced, tfdiags.Diagnostics)

func (*RefreshCommand) Run

func (c *RefreshCommand) Run(rawArgs []string) int

func (*RefreshCommand) Synopsis

func (c *RefreshCommand) Synopsis() string

type ShowCommand

type ShowCommand struct {
	Meta
}

ShowCommand is a Command implementation that reads and outputs the contents of a Terraform plan or state file.

func (*ShowCommand) Help

func (c *ShowCommand) Help() string

func (*ShowCommand) Run

func (c *ShowCommand) Run(args []string) int

func (*ShowCommand) Synopsis

func (c *ShowCommand) Synopsis() string

type StateCommand added in v0.7.0

type StateCommand struct {
	StateMeta
}

StateCommand is a Command implementation that just shows help for the subcommands nested below it.

func (*StateCommand) Help added in v0.7.0

func (c *StateCommand) Help() string

func (*StateCommand) Run added in v0.7.0

func (c *StateCommand) Run(args []string) int

func (*StateCommand) Synopsis added in v0.7.0

func (c *StateCommand) Synopsis() string

type StateListCommand added in v0.7.0

type StateListCommand struct {
	Meta
	StateMeta
}

StateListCommand is a Command implementation that lists the resources within a state file.

func (*StateListCommand) Help added in v0.7.0

func (c *StateListCommand) Help() string

func (*StateListCommand) Run added in v0.7.0

func (c *StateListCommand) Run(args []string) int

func (*StateListCommand) Synopsis added in v0.7.0

func (c *StateListCommand) Synopsis() string

type StateMeta added in v0.7.0

type StateMeta struct {
	Meta
}

StateMeta is the meta struct that should be embedded in state subcommands.

func (*StateMeta) State added in v0.7.0

func (c *StateMeta) 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 added in v0.7.0

type StateMvCommand struct {
	StateMeta
}

StateMvCommand is a Command implementation that shows a single resource.

func (*StateMvCommand) Help added in v0.7.0

func (c *StateMvCommand) Help() string

func (*StateMvCommand) Run added in v0.7.0

func (c *StateMvCommand) Run(args []string) int

func (*StateMvCommand) Synopsis added in v0.7.0

func (c *StateMvCommand) Synopsis() string

type StatePullCommand added in v0.9.0

type StatePullCommand struct {
	Meta
	StateMeta
}

StatePullCommand is a Command implementation that shows a single resource.

func (*StatePullCommand) Help added in v0.9.0

func (c *StatePullCommand) Help() string

func (*StatePullCommand) Run added in v0.9.0

func (c *StatePullCommand) Run(args []string) int

func (*StatePullCommand) Synopsis added in v0.9.0

func (c *StatePullCommand) Synopsis() string

type StatePushCommand added in v0.9.0

type StatePushCommand struct {
	Meta
	StateMeta
}

StatePushCommand is a Command implementation that shows a single resource.

func (*StatePushCommand) Help added in v0.9.0

func (c *StatePushCommand) Help() string

func (*StatePushCommand) Run added in v0.9.0

func (c *StatePushCommand) Run(args []string) int

func (*StatePushCommand) Synopsis added in v0.9.0

func (c *StatePushCommand) Synopsis() string

type StateReplaceProviderCommand added in v0.13.0

type StateReplaceProviderCommand struct {
	StateMeta
}

func (*StateReplaceProviderCommand) Help added in v0.13.0

func (*StateReplaceProviderCommand) Run added in v0.13.0

func (c *StateReplaceProviderCommand) Run(args []string) int

func (*StateReplaceProviderCommand) Synopsis added in v0.13.0

func (c *StateReplaceProviderCommand) Synopsis() string

type StateRmCommand added in v0.7.1

type StateRmCommand struct {
	StateMeta
}

StateRmCommand is a Command implementation that shows a single resource.

func (*StateRmCommand) Help added in v0.7.1

func (c *StateRmCommand) Help() string

func (*StateRmCommand) Run added in v0.7.1

func (c *StateRmCommand) Run(args []string) int

func (*StateRmCommand) Synopsis added in v0.7.1

func (c *StateRmCommand) Synopsis() string

type StateShowCommand added in v0.7.0

type StateShowCommand struct {
	Meta
	StateMeta
}

StateShowCommand is a Command implementation that shows a single resource.

func (*StateShowCommand) Help added in v0.7.0

func (c *StateShowCommand) Help() string

func (*StateShowCommand) Run added in v0.7.0

func (c *StateShowCommand) Run(args []string) int

func (*StateShowCommand) Synopsis added in v0.7.0

func (c *StateShowCommand) Synopsis() string

type TaintCommand added in v0.4.0

type TaintCommand struct {
	Meta
}

TaintCommand is a cli.Command implementation that manually taints a resource, marking it for recreation.

func (*TaintCommand) Help added in v0.4.0

func (c *TaintCommand) Help() string

func (*TaintCommand) Run added in v0.4.0

func (c *TaintCommand) Run(args []string) int

func (*TaintCommand) Synopsis added in v0.4.0

func (c *TaintCommand) Synopsis() string

type TestCommand added in v0.15.0

type TestCommand struct {
	Meta
}

TestCommand is the implementation of "terraform test".

func (*TestCommand) Help added in v0.15.0

func (c *TestCommand) Help() string

func (*TestCommand) Run added in v0.15.0

func (c *TestCommand) Run(rawArgs []string) int

func (*TestCommand) Synopsis added in v0.15.0

func (c *TestCommand) Synopsis() string

type UIInput added in v0.3.0

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 terraform.UIInput that asks the CLI for input stdin.

func (*UIInput) Input added in v0.3.0

func (i *UIInput) Input(ctx context.Context, opts *terraform.InputOpts) (string, error)

type UnlockCommand added in v0.9.0

type UnlockCommand struct {
	Meta
}

UnlockCommand is a cli.Command implementation that manually unlocks the state.

func (*UnlockCommand) Help added in v0.9.0

func (c *UnlockCommand) Help() string

func (*UnlockCommand) Run added in v0.9.0

func (c *UnlockCommand) Run(args []string) int

func (*UnlockCommand) Synopsis added in v0.9.0

func (c *UnlockCommand) Synopsis() string

type UntaintCommand added in v0.6.13

type UntaintCommand struct {
	Meta
}

UntaintCommand is a cli.Command implementation that manually untaints a resource, marking it as primary and ready for service.

func (*UntaintCommand) Help added in v0.6.13

func (c *UntaintCommand) Help() string

func (*UntaintCommand) Run added in v0.6.13

func (c *UntaintCommand) Run(args []string) int

func (*UntaintCommand) Synopsis added in v0.6.13

func (c *UntaintCommand) Synopsis() string

type ValidateCommand added in v0.6.12

type ValidateCommand struct {
	Meta
}

ValidateCommand is a Command implementation that validates the terraform files

func (*ValidateCommand) Help added in v0.6.12

func (c *ValidateCommand) Help() string

func (*ValidateCommand) Run added in v0.6.12

func (c *ValidateCommand) Run(rawArgs []string) int

func (*ValidateCommand) Synopsis added in v0.6.12

func (c *ValidateCommand) Synopsis() string

type VersionCheckFunc added in v0.3.0

type VersionCheckFunc func() (VersionCheckInfo, error)

VersionCheckFunc is the callback called by the Version command to check if there is a new version of Terraform.

type VersionCheckInfo added in v0.3.0

type VersionCheckInfo struct {
	Outdated bool
	Latest   string
	Alerts   []string
}

VersionCheckInfo is the return value for the VersionCheckFunc callback and tells the Version command information about the latest version of Terraform.

type VersionCommand

type VersionCommand struct {
	Meta

	Version           string
	VersionPrerelease string
	CheckFunc         VersionCheckFunc
	Platform          getproviders.Platform
}

VersionCommand is a Command implementation prints the version.

func (*VersionCommand) Help

func (c *VersionCommand) Help() string

func (*VersionCommand) Run

func (c *VersionCommand) Run(args []string) int

func (*VersionCommand) Synopsis

func (c *VersionCommand) Synopsis() string

type VersionOutput added in v0.13.0

type VersionOutput struct {
	Version            string            `json:"terraform_version"`
	Platform           string            `json:"platform"`
	ProviderSelections map[string]string `json:"provider_selections"`
	Outdated           bool              `json:"terraform_outdated"`
}

type WorkspaceCommand added in v0.10.0

type WorkspaceCommand struct {
	Meta
	LegacyName bool
}

WorkspaceCommand is a Command Implementation that manipulates workspaces, which allow multiple distinct states and variables from a single config.

func (*WorkspaceCommand) Help added in v0.10.0

func (c *WorkspaceCommand) Help() string

func (*WorkspaceCommand) Run added in v0.10.0

func (c *WorkspaceCommand) Run(args []string) int

func (*WorkspaceCommand) Synopsis added in v0.10.0

func (c *WorkspaceCommand) Synopsis() string

type WorkspaceDeleteCommand added in v0.10.0

type WorkspaceDeleteCommand struct {
	Meta
	LegacyName bool
}

func (*WorkspaceDeleteCommand) AutocompleteArgs added in v0.10.7

func (c *WorkspaceDeleteCommand) AutocompleteArgs() complete.Predictor

func (*WorkspaceDeleteCommand) AutocompleteFlags added in v0.10.7

func (c *WorkspaceDeleteCommand) AutocompleteFlags() complete.Flags

func (*WorkspaceDeleteCommand) Help added in v0.10.0

func (c *WorkspaceDeleteCommand) Help() string

func (*WorkspaceDeleteCommand) Run added in v0.10.0

func (c *WorkspaceDeleteCommand) Run(args []string) int

func (*WorkspaceDeleteCommand) Synopsis added in v0.10.0

func (c *WorkspaceDeleteCommand) Synopsis() string

type WorkspaceListCommand added in v0.10.0

type WorkspaceListCommand struct {
	Meta
	LegacyName bool
}

func (*WorkspaceListCommand) AutocompleteArgs added in v0.10.7

func (c *WorkspaceListCommand) AutocompleteArgs() complete.Predictor

func (*WorkspaceListCommand) AutocompleteFlags added in v0.10.7

func (c *WorkspaceListCommand) AutocompleteFlags() complete.Flags

func (*WorkspaceListCommand) Help added in v0.10.0

func (c *WorkspaceListCommand) Help() string

func (*WorkspaceListCommand) Run added in v0.10.0

func (c *WorkspaceListCommand) Run(args []string) int

func (*WorkspaceListCommand) Synopsis added in v0.10.0

func (c *WorkspaceListCommand) Synopsis() string

type WorkspaceNewCommand added in v0.10.0

type WorkspaceNewCommand struct {
	Meta
	LegacyName bool
}

func (*WorkspaceNewCommand) AutocompleteArgs added in v0.10.7

func (c *WorkspaceNewCommand) AutocompleteArgs() complete.Predictor

func (*WorkspaceNewCommand) AutocompleteFlags added in v0.10.7

func (c *WorkspaceNewCommand) AutocompleteFlags() complete.Flags

func (*WorkspaceNewCommand) Help added in v0.10.0

func (c *WorkspaceNewCommand) Help() string

func (*WorkspaceNewCommand) Run added in v0.10.0

func (c *WorkspaceNewCommand) Run(args []string) int

func (*WorkspaceNewCommand) Synopsis added in v0.10.0

func (c *WorkspaceNewCommand) Synopsis() string

type WorkspaceSelectCommand added in v0.10.0

type WorkspaceSelectCommand struct {
	Meta
	LegacyName bool
}

func (*WorkspaceSelectCommand) AutocompleteArgs added in v0.10.7

func (c *WorkspaceSelectCommand) AutocompleteArgs() complete.Predictor

func (*WorkspaceSelectCommand) AutocompleteFlags added in v0.10.7

func (c *WorkspaceSelectCommand) AutocompleteFlags() complete.Flags

func (*WorkspaceSelectCommand) Help added in v0.10.0

func (c *WorkspaceSelectCommand) Help() string

func (*WorkspaceSelectCommand) Run added in v0.10.0

func (c *WorkspaceSelectCommand) Run(args []string) int

func (*WorkspaceSelectCommand) Synopsis added in v0.10.0

func (c *WorkspaceSelectCommand) Synopsis() string

type WorkspaceShowCommand added in v0.10.0

type WorkspaceShowCommand struct {
	Meta
}

func (*WorkspaceShowCommand) AutocompleteArgs added in v0.10.7

func (c *WorkspaceShowCommand) AutocompleteArgs() complete.Predictor

func (*WorkspaceShowCommand) AutocompleteFlags added in v0.10.7

func (c *WorkspaceShowCommand) AutocompleteFlags() complete.Flags

func (*WorkspaceShowCommand) Help added in v0.10.0

func (c *WorkspaceShowCommand) Help() string

func (*WorkspaceShowCommand) Run added in v0.10.0

func (c *WorkspaceShowCommand) Run(args []string) int

func (*WorkspaceShowCommand) Synopsis added in v0.10.0

func (c *WorkspaceShowCommand) Synopsis() string

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.
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 small number of tests that run against a real Terraform binary, compiled on the fly at the start of the test run.
Package e2etest contains a small number of tests that run against a real Terraform binary, compiled on the fly at the start of the test run.
Package format contains helpers for formatting various Terraform structures for human-readabout output.
Package format contains helpers for formatting various Terraform structures for human-readabout output.
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 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 terraform provider schemas into a json formatted output.
Package jsonprovider contains types and functions to marshal terraform 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

Jump to

Keyboard shortcuts

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