Documentation
¶
Index ¶
- Constants
- func FormatPlan(opts *FormatPlanOpts) string
- func FormatState(opts *FormatStateOpts) string
- type ApplyCommand
- type ColorizeUi
- type Config
- type CountHook
- type FlagVar
- type FlagVarFile
- 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) Input() bool
- func (m *Meta) InputMode() terraform.InputMode
- func (m *Meta) PersistState(s *terraform.State) error
- func (m *Meta) StateOutPath() string
- func (m *Meta) UIInput() terraform.UIInput
- type OutputCommand
- type PlanCommand
- type PullCommand
- type PushCommand
- type RefreshCommand
- type RemoteCommand
- type ShowCommand
- 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 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
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.
type ColorizeUi ¶
type ColorizeUi struct {
Colorize *colorstring.Colorize
OutputColor string
InfoColor string
ErrorColor 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.
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
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)
type FlagVar ¶
type FlagVar map[string]string
FlagVar is a flag.Value implementation for parsing user variables from the command-line in the format of '-var key=value'.
type FlagVarFile ¶
type FlagVarFile map[string]string
FlagVarFile is a flag.Value implementation for parsing user variables from the command line in the form of files. i.e. '-var-file=foo'
type FormatPlanOpts ¶ added in v0.3.0
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 ¶ added in v0.3.0
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 ¶ added in v0.3.0
type GetCommand struct {
Meta
}
GetCommand is a Command implementation that takes a Terraform configuration and downloads all the modules.
type GraphCommand ¶
type GraphCommand struct {
Meta
}
GraphCommand is a Command implementation that takes a Terraform configuration and outputs the dependency tree in graphical form.
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.
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 ¶
func (m *Meta) Context(copts contextOpts) (*terraform.Context, bool, error)
Context returns a Terraform Context taking into account the context options used to initialize this meta configuration.
func (*Meta) Input ¶ added in v0.3.5
func (m *Meta) Input() bool
Input returns true if we should ask for input for context.
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) PersistState ¶ added in v0.3.5
func (m *Meta) PersistState(s *terraform.State) error
PersistState is used to write out the state, handling backup of the existing state file and respecting path configurations.
func (*Meta) StateOutPath ¶ added in v0.3.5
func (m *Meta) StateOutPath() string
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.
type PlanCommand ¶
type PlanCommand struct {
Meta
}
PlanCommand is a Command implementation that compares a Terraform configuration to an actual infrastructure and shows the differences.
type PullCommand ¶ added in v0.3.5
type PullCommand struct {
Meta
}
type PushCommand ¶ added in v0.3.5
type PushCommand struct {
Meta
}
type RefreshCommand ¶
type RefreshCommand struct {
Meta
}
RefreshCommand is a cli.Command implementation that refreshes the state file.
type RemoteCommand ¶ added in v0.3.5
type RemoteCommand struct {
Meta
// contains filtered or unexported fields
}
RemoteCommand is a Command implementation that is used to enable and disable remote state management
type ShowCommand ¶
type ShowCommand struct {
Meta
}
ShowCommand is a Command implementation that reads and outputs the contents of a Terraform plan or state file.
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
// 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 ¶ added in v0.3.0
func (h *UiHook) ProvisionOutput(
n *terraform.InstanceInfo,
provId string,
msg 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
Revision string
Version string
VersionPrerelease string
CheckFunc VersionCheckFunc
}
VersionCommand is a Command implementation prints the version.