Documentation ¶
Overview ¶
Package terraform provides a harness for the Terraform CLI. It is known to work with Terraform v0.14.7.
Index ¶
- func Classify(err error) error
- type FileFormat
- type Harness
- func (h Harness) Apply(ctx context.Context, o ...Option) error
- func (h Harness) Destroy(ctx context.Context, o ...Option) error
- func (h Harness) Diff(ctx context.Context, o ...Option) (bool, error)
- func (h Harness) Init(ctx context.Context, o ...InitOption) error
- func (h Harness) Outputs(ctx context.Context) ([]Output, error)
- func (h Harness) Resources(ctx context.Context) ([]string, error)
- func (h Harness) Validate(ctx context.Context) error
- func (h Harness) Workspace(ctx context.Context, name string) error
- type InitOption
- type Option
- type Output
- type OutputType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type FileFormat ¶
type FileFormat int
The FileFormat of a Terraform file.
const ( Unknown FileFormat = iota HCL JSON )
Supported Terraform file formats.
type Harness ¶
type Harness struct { // Path to the terraform binary. Path string // Dir in which to execute the terraform binary. Dir string }
A Harness for running the terraform binary.
func (Harness) Diff ¶
Diff invokes 'terraform plan' to determine whether there is a diff between the desired and the actual state of the configuration. It returns true if there is a diff.
func (Harness) Init ¶
func (h Harness) Init(ctx context.Context, o ...InitOption) error
Init initializes a Terraform configuration.
func (Harness) Validate ¶
Validate a Terraform configuration. Note that there may be interplay between validation and initialization. A configuration that needs to be initialized but isn't is deemed invalid. Attempts to initialise an invalid configuration will result in errors, which are not available in a machine readable format.
type InitOption ¶
type InitOption func(o *initOptions)
An InitOption affects how a Terraform is initialized.
func FromModule ¶
func FromModule(module string) InitOption
FromModule can be used to initialize a Terraform configuration from a module, which may be pulled from git, a local directory, a storage bucket, etc.
type Option ¶
type Option func(o *options)
An Option affects how a Terraform is invoked.
func WithVarFile ¶
func WithVarFile(data []byte, f FileFormat) Option
WithVarFile supplies a file of Terraform variables.
type Output ¶
type Output struct { Name string Sensitive bool Type OutputType // contains filtered or unexported fields }
An Output from Terraform.
func (Output) BoolValue ¶
BoolValue returns the output's value as a boolean. It should only be used for outputs of type 'bool'.
func (Output) JSONValue ¶
JSONValue returns the output's value as JSON. It may be used for outputs of any type.
func (Output) NumberValue ¶
NumberValue returns the output's value as a number. It should only be used for outputs of type 'number'.
func (Output) StringValue ¶
StringValue returns the output's value as a string. It should only be used for outputs of type 'string'.
type OutputType ¶
type OutputType int
An OutputType of Terraform.
const ( OutputTypeUnknown OutputType = iota OutputTypeString OutputTypeNumber OutputTypeBool OutputTypeTuple OutputTypeObject )
Terraform output types.