Documentation ¶
Index ¶
- Constants
- func FormatPlan(opts *FormatPlanOpts) string
- func FormatState(opts *FormatStateOpts) string
- func StateFromPlan(localPath string, plan *terraform.Plan) (state.State, string, error)
- type ApplyCommand
- type ColorizeUi
- type Config
- type CountHook
- func (h *CountHook) PostApply(n *terraform.InstanceInfo, s *terraform.InstanceState, e error) (terraform.HookAction, error)
- func (h *CountHook) PostDiff(n *terraform.InstanceInfo, d *terraform.InstanceDiff) (terraform.HookAction, error)
- func (h *CountHook) PreApply(n *terraform.InstanceInfo, s *terraform.InstanceState, ...) (terraform.HookAction, error)
- func (h *CountHook) Reset()
- type FlagKV
- type FlagKVFile
- type FlagStringSlice
- type FormatPlanOpts
- type FormatStateOpts
- type GetCommand
- type GraphCommand
- type InitCommand
- type Meta
- func (m *Meta) Colorize() *colorstring.Colorize
- func (m *Meta) Context(copts contextOpts) (*terraform.Context, bool, error)
- func (m *Meta) DataDir() string
- func (m *Meta) Input() bool
- func (m *Meta) InputMode() terraform.InputMode
- func (m *Meta) PersistState(s *terraform.State) error
- func (m *Meta) State() (state.State, error)
- func (m *Meta) StateOpts() *StateOpts
- func (m *Meta) StateOutPath() string
- func (m *Meta) StateRaw(opts *StateOpts) (*StateResult, error)
- func (m *Meta) UIInput() terraform.UIInput
- type OutputCommand
- type PlanCommand
- type PushCommand
- type RefreshCommand
- type RemoteCommand
- type RemoteConfigCommand
- type RemotePullCommand
- type RemotePushCommand
- type ShowCommand
- type StateHook
- type StateOpts
- type StateResult
- type TaintCommand
- type UIInput
- type UiHook
- func (h *UiHook) PostApply(n *terraform.InstanceInfo, s *terraform.InstanceState, applyerr error) (terraform.HookAction, error)
- func (h *UiHook) PreApply(n *terraform.InstanceInfo, s *terraform.InstanceState, ...) (terraform.HookAction, error)
- func (h *UiHook) PreDiff(n *terraform.InstanceInfo, s *terraform.InstanceState) (terraform.HookAction, error)
- func (h *UiHook) PreProvision(n *terraform.InstanceInfo, provId string) (terraform.HookAction, error)
- func (h *UiHook) PreRefresh(n *terraform.InstanceInfo, s *terraform.InstanceState) (terraform.HookAction, error)
- func (h *UiHook) ProvisionOutput(n *terraform.InstanceInfo, provId string, msg string)
- type VersionCheckFunc
- type VersionCheckInfo
- type VersionCommand
Constants ¶
const DefaultBackupExtention = ".backup"
DefaultBackupExtention is added to the state file to form the path
const DefaultDataDir = ".terraform"
DefaultDataDir is the default directory for storing local data.
const DefaultDataDirectory = ".terraform"
DefaultDataDirectory is the directory where local state is stored by default.
const DefaultStateFilename = "terraform.tfstate"
DefaultStateFilename is the default filename used for the state file.
const DefaultVarsFilename = "terraform.tfvars"
DefaultVarsFilename is the default filename used for vars
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" )
const (
// The name of the environment variable that can be used to set module depth.
ModuleDepthEnvVar = "TF_MODULE_DEPTH"
)
Variables ¶
This section is empty.
Functions ¶
func FormatPlan ¶
func FormatPlan(opts *FormatPlanOpts) string
FormatPlan takes a plan and returns a
func FormatState ¶
func FormatState(opts *FormatStateOpts) string
FormatState takes a state and returns a string
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 // When this channel is closed, the apply will be cancelled. ShutdownCh <-chan struct{} }
ApplyCommand is a Command implementation that applies a Terraform configuration and actually builds or changes infrastructure.
func (*ApplyCommand) Help ¶
func (c *ApplyCommand) Help() string
func (*ApplyCommand) Run ¶
func (c *ApplyCommand) Run(args []string) int
func (*ApplyCommand) Synopsis ¶
func (c *ApplyCommand) Synopsis() string
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) 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 ¶
func (u *ColorizeUi) Warn(message string)
type Config ¶
type Config struct { Hooks []terraform.Hook Providers map[string]terraform.ResourceProviderFactory Ui cli.Ui }
Config is a structure used to configure many commands with Terraform configurations.
func (*Config) ContextOpts ¶
func (c *Config) ContextOpts() *terraform.ContextOpts
type CountHook ¶
type CountHook struct { Added int Changed int Removed int ToAdd int ToChange int ToRemove int ToRemoveAndAdd int sync.Mutex terraform.NilHook // contains filtered or unexported fields }
CountHook is a hook that counts the number of resources added, removed, changed during the course of an apply.
func (*CountHook) PostApply ¶
func (h *CountHook) PostApply( n *terraform.InstanceInfo, s *terraform.InstanceState, e error) (terraform.HookAction, error)
func (*CountHook) PostDiff ¶
func (h *CountHook) PostDiff( n *terraform.InstanceInfo, d *terraform.InstanceDiff) ( terraform.HookAction, error)
func (*CountHook) PreApply ¶
func (h *CountHook) PreApply( n *terraform.InstanceInfo, s *terraform.InstanceState, d *terraform.InstanceDiff) (terraform.HookAction, error)
type FlagKV ¶
FlagKV is a flag.Value implementation for parsing user variables from the command-line in the format of '-var key=value'.
type FlagKVFile ¶
FlagKVFile is a flag.Value implementation for parsing user variables from the command line in the form of files. i.e. '-var-file=foo'
func (*FlagKVFile) Set ¶
func (v *FlagKVFile) Set(raw string) error
func (*FlagKVFile) String ¶
func (v *FlagKVFile) String() string
type FlagStringSlice ¶
type FlagStringSlice []string
func (*FlagStringSlice) Set ¶
func (v *FlagStringSlice) Set(raw string) error
func (*FlagStringSlice) String ¶
func (v *FlagStringSlice) String() string
type FormatPlanOpts ¶
type FormatPlanOpts struct { // Plan is the plan to format. This is required. Plan *terraform.Plan // Color is the colorizer. This is optional. Color *colorstring.Colorize // ModuleDepth is the depth of the modules to expand. By default this // is zero which will not expand modules at all. ModuleDepth int }
FormatPlanOpts are the options for formatting a plan.
type FormatStateOpts ¶
type FormatStateOpts struct { // State is the state to format. This is required. State *terraform.State // Color is the colorizer. This is optional. Color *colorstring.Colorize // ModuleDepth is the depth of the modules to expand. By default this // is zero which will not expand modules at all. ModuleDepth int }
FormatStateOpts are the options for formatting a state.
type GetCommand ¶
type GetCommand struct {
Meta
}
GetCommand is a Command implementation that takes a Terraform configuration and downloads all the modules.
func (*GetCommand) Help ¶
func (c *GetCommand) Help() string
func (*GetCommand) Run ¶
func (c *GetCommand) Run(args []string) int
func (*GetCommand) Synopsis ¶
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 InitCommand ¶
type InitCommand struct {
Meta
}
InitCommand is a Command implementation that takes a Terraform module and clones it to the working directory.
func (*InitCommand) Help ¶
func (c *InitCommand) Help() string
func (*InitCommand) Run ¶
func (c *InitCommand) Run(args []string) int
func (*InitCommand) Synopsis ¶
func (c *InitCommand) Synopsis() string
type Meta ¶
type Meta struct { Color bool ContextOpts *terraform.ContextOpts Ui cli.Ui // contains filtered or unexported fields }
Meta are the meta-options that are available on all or most commands.
func (*Meta) Colorize ¶
func (m *Meta) Colorize() *colorstring.Colorize
Colorize returns the colorization structure for a command.
func (*Meta) Context ¶
Context returns a Terraform Context taking into account the context options used to initialize this meta configuration.
func (*Meta) 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) PersistState ¶
PersistState is used to write out the state, handling backup of the existing state file and respecting path configurations.
func (*Meta) StateOutPath ¶
StateOutPath returns the true output path for the state file
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) Run ¶
func (c *OutputCommand) Run(args []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) Help ¶
func (c *PlanCommand) Help() string
func (*PlanCommand) Run ¶
func (c *PlanCommand) Run(args []string) int
func (*PlanCommand) Synopsis ¶
func (c *PlanCommand) Synopsis() string
type PushCommand ¶
type PushCommand struct { Meta // contains filtered or unexported fields }
func (*PushCommand) Help ¶
func (c *PushCommand) Help() string
func (*PushCommand) Run ¶
func (c *PushCommand) Run(args []string) int
func (*PushCommand) Synopsis ¶
func (c *PushCommand) Synopsis() string
type RefreshCommand ¶
type RefreshCommand struct {
Meta
}
RefreshCommand is a cli.Command implementation that refreshes the state file.
func (*RefreshCommand) Help ¶
func (c *RefreshCommand) Help() string
func (*RefreshCommand) Run ¶
func (c *RefreshCommand) Run(args []string) int
func (*RefreshCommand) Synopsis ¶
func (c *RefreshCommand) Synopsis() string
type RemoteCommand ¶
type RemoteCommand struct {
Meta
}
func (*RemoteCommand) Help ¶
func (c *RemoteCommand) Help() string
func (*RemoteCommand) Run ¶
func (c *RemoteCommand) Run(argsRaw []string) int
func (*RemoteCommand) Synopsis ¶
func (c *RemoteCommand) Synopsis() string
type RemoteConfigCommand ¶
type RemoteConfigCommand struct { Meta // contains filtered or unexported fields }
RemoteConfigCommand is a Command implementation that is used to enable and disable remote state management
func (*RemoteConfigCommand) Help ¶
func (c *RemoteConfigCommand) Help() string
func (*RemoteConfigCommand) Run ¶
func (c *RemoteConfigCommand) Run(args []string) int
func (*RemoteConfigCommand) Synopsis ¶
func (c *RemoteConfigCommand) Synopsis() string
type RemotePullCommand ¶
type RemotePullCommand struct {
Meta
}
func (*RemotePullCommand) Help ¶
func (c *RemotePullCommand) Help() string
func (*RemotePullCommand) Run ¶
func (c *RemotePullCommand) Run(args []string) int
func (*RemotePullCommand) Synopsis ¶
func (c *RemotePullCommand) Synopsis() string
type RemotePushCommand ¶
type RemotePushCommand struct {
Meta
}
func (*RemotePushCommand) Help ¶
func (c *RemotePushCommand) Help() string
func (*RemotePushCommand) Run ¶
func (c *RemotePushCommand) Run(args []string) int
func (*RemotePushCommand) Synopsis ¶
func (c *RemotePushCommand) 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 StateHook ¶
StateHook is a hook that continuously updates the state by calling WriteState on a state.State.
func (*StateHook) PostStateUpdate ¶
type StateOpts ¶
type StateOpts struct { // LocalPath is the path where the state is stored locally. // // LocalPathOut is the path where the local state will be saved. If this // isn't set, it will be saved back to LocalPath. LocalPath string LocalPathOut string // RemotePath is the path where the remote state cache would be. // // RemoteCache, if true, will set the result to only be the cache // and not backed by any real durable storage. RemotePath string RemoteCacheOnly bool RemoteRefresh bool // BackupPath is the path where the backup will be placed. If not set, // it is assumed to be the path where the state is stored locally // plus the DefaultBackupExtension. BackupPath string }
StateOpts are options to get the state for a command.
type StateResult ¶
type StateResult struct { // State is the final outer state that should be used for all // _real_ reads/writes. // // StatePath is the local path where the state will be stored or // cached, no matter whether State is local or remote. State state.State StatePath string // Local and Remote are the local/remote state implementations, raw // and unwrapped by any backups. The paths here are the paths where // these state files would be saved. Local *state.LocalState LocalPath string Remote *state.CacheState RemotePath string }
StateResult is the result of calling State and holds various different State implementations so they can be accessed directly.
func State ¶
func State(opts *StateOpts) (*StateResult, error)
State returns the proper state.State implementation to represent the current environment.
localPath is the path to where state would be if stored locally. dataDir is the path to the local data directory where the remote state cache would be stored.
type TaintCommand ¶
type TaintCommand struct {
Meta
}
TaintCommand is a cli.Command implementation that manually taints a resource, marking it for recreation.
func (*TaintCommand) Help ¶
func (c *TaintCommand) Help() string
func (*TaintCommand) Run ¶
func (c *TaintCommand) Run(args []string) int
func (*TaintCommand) Synopsis ¶
func (c *TaintCommand) Synopsis() string
type UIInput ¶
type UIInput struct { // Colorize will color the output. Colorize *colorstring.Colorize // Reader and Writer for IO. If these aren't set, they will default to // Stdout and Stderr 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.
type UiHook ¶
type UiHook struct { terraform.NilHook Colorize *colorstring.Colorize Ui cli.Ui // contains filtered or unexported fields }
func (*UiHook) PostApply ¶
func (h *UiHook) PostApply( n *terraform.InstanceInfo, s *terraform.InstanceState, applyerr error) (terraform.HookAction, error)
func (*UiHook) PreApply ¶
func (h *UiHook) PreApply( n *terraform.InstanceInfo, s *terraform.InstanceState, d *terraform.InstanceDiff) (terraform.HookAction, error)
func (*UiHook) PreDiff ¶
func (h *UiHook) PreDiff( n *terraform.InstanceInfo, s *terraform.InstanceState) (terraform.HookAction, error)
func (*UiHook) PreProvision ¶
func (h *UiHook) PreProvision( n *terraform.InstanceInfo, provId string) (terraform.HookAction, error)
func (*UiHook) PreRefresh ¶
func (h *UiHook) PreRefresh( n *terraform.InstanceInfo, s *terraform.InstanceState) (terraform.HookAction, error)
func (*UiHook) ProvisionOutput ¶
func (h *UiHook) ProvisionOutput( n *terraform.InstanceInfo, provId string, msg string)
type VersionCheckFunc ¶
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 ¶
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 Revision string Version string VersionPrerelease string CheckFunc VersionCheckFunc }
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
Source Files ¶
- apply.go
- cli_ui.go
- command.go
- config.go
- counthookaction_string.go
- flag_kv.go
- format_plan.go
- format_state.go
- get.go
- graph.go
- hook_count.go
- hook_count_action.go
- hook_state.go
- hook_ui.go
- init.go
- meta.go
- module_storage.go
- output.go
- plan.go
- push.go
- refresh.go
- remote.go
- remote_config.go
- remote_pull.go
- remote_push.go
- show.go
- state.go
- taint.go
- ui_input.go
- version.go