terraform

package
v0.0.28 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2024 License: MPL-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Command

type Command int

Command is a Terraform sub-command.

type Config

type Config struct {
	UI             *terminal.UI      // UI to use for input/output
	BinPath        string            // where terraform binary is
	ConfigPath     string            // where the terraformrc config is
	DirPath        string            // what directory to execute the command in
	Env            map[string]string // environment variables
	ExecSubCmd     string            // raw command to run
	OutputName     string            // output name
	FailOnWarnings bool              // fail on warning diagnostics
	Flags          *pb.Terraform_Runner_Config_Flags
}

Config is the Terraform CLI executor configuration.

func NewConfig

func NewConfig(opts ...ConfigOpt) *Config

NewConfig takes options and returns a new instance of config.

func (*Config) ApplyOptions

func (c *Config) ApplyOptions() []tfexec.ApplyOption

ApplyOptions are the apply command options.

func (*Config) DestroyOptions

func (c *Config) DestroyOptions() []tfexec.DestroyOption

DestroyOptions are the destroy command options.

func (*Config) FromProto

func (c *Config) FromProto(pcfg *pb.Terraform_Runner_Config)

FromProto unmarshals and instance of a proto terraform executor configuration into itself.

func (*Config) InitOptions

func (c *Config) InitOptions() []tfexec.InitOption

InitOptions are the init command options.

func (*Config) NewExecSubCmd

func (c *Config) NewExecSubCmd() *command.Command

NewExecSubCmd creates a new instance of a command to run a terraform sub-command.

func (*Config) OutputOptions

func (c *Config) OutputOptions() []tfexec.OutputOption

OutputOptions are the output commands options.

func (*Config) PlanOptions

func (c *Config) PlanOptions() []tfexec.PlanOption

PlanOptions are the plan command options.

func (*Config) Proto

func (c *Config) Proto() *pb.Terraform_Runner_Config

Proto returns the instance of config as proto terraform executor config.

func (*Config) ShowOptions

func (c *Config) ShowOptions() []tfexec.ShowOption

ShowOptions are the show command options.

func (*Config) Terraform

func (c *Config) Terraform() (*tfexec.Terraform, error)

Terraform returns a new instance of a configured *tfexec.Terraform.

func (*Config) WithModule

func (c *Config) WithModule(mod *pb.Terraform_Module)

WithModule updates the module directory and config path of the Terraform config file with that of a Terraform_Module.

type ConfigOpt

type ConfigOpt func(*Config)

ConfigOpt is a Terraform CLI executor configuration option.

func WithBinPath

func WithBinPath(path string) ConfigOpt

WithBinPath sets the terraform binary path.

func WithConfigPath

func WithConfigPath(path string) ConfigOpt

WithConfigPath sets the terraform.rc path.

func WithDirPath

func WithDirPath(path string) ConfigOpt

WithDirPath sets the terraform module directory path.

func WithEnv

func WithEnv(env map[string]string) ConfigOpt

WithEnv set environment variables.

func WithExecSubCommand

func WithExecSubCommand(cmd string) ConfigOpt

WithExecSubCommand set the raw sub-command.

func WithLockTimeout

func WithLockTimeout(timeout time.Duration) ConfigOpt

WithLockTimeout sets the state lock timeout.

func WithNoBackend

func WithNoBackend() ConfigOpt

WithNoBackend disables the configured backend.

func WithNoDownload

func WithNoDownload() ConfigOpt

WithNoDownload disables module and provider downloading during init.

func WithNoLock

func WithNoLock() ConfigOpt

WithNoLock disables waiting for the state lock.

func WithNoReconfigure

func WithNoReconfigure() ConfigOpt

WithNoReconfigure don't reconfigure the backend during.

func WithNoRefresh

func WithNoRefresh() ConfigOpt

WithNoRefresh disables refreshing during plan and apply.

func WithParallelism

func WithParallelism(p int) ConfigOpt

WithParallelism sets the parallelism.

func WithProtoConfig

func WithProtoConfig(pcfg *pb.Terraform_Runner_Config) ConfigOpt

WithProtoConfig sets configuration from a proto config.

func WithRefreshOnly

func WithRefreshOnly() ConfigOpt

WithRefreshOnly does refresh only mode.

func WithUI

func WithUI(ui *terminal.UI) ConfigOpt

WithUI sets the UI.

func WithUpgrade

func WithUpgrade() ConfigOpt

WithUpgrade upgrades the terraform providers and modules during init.

type Flag

type Flag int

Flag is a Terraform sub-command config flag.

Directories

Path Synopsis
Package format provides functions for formatting Terraform and cty as text.
Package format provides functions for formatting Terraform and cty as text.

Jump to

Keyboard shortcuts

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