terraform

package
v0.42.1 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2023 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FindArtifactVersions

func FindArtifactVersions(tfs []File) ([]*model.ArtifactVersion, error)

FindArtifactVersions parses artifact versions from Terraform files. For Terraform, module version is an artifact version.

func GetExitCode

func GetExitCode(err error) int

Types

type File

type File struct {
	Modules []*Module
}

File represents a Terraform file.

func LoadTerraformFiles

func LoadTerraformFiles(dir string) ([]File, error)

LoadTerraformFiles loads terraform files from a given dir.

type FileMapping

type FileMapping struct {
	ModuleMappings []*ModuleMapping `hcl:"module,block"`
	Remain         hcl.Body         `hcl:",remain"`
}

FileMapping is a schema for Terraform file.

type Module

type Module struct {
	Name    string
	Source  string
	Version string
}

Module represents a "module" block in Terraform file.

type ModuleMapping

type ModuleMapping struct {
	Name    string   `hcl:"name,label"`
	Source  string   `hcl:"source"`
	Version string   `hcl:"version,optional"`
	Remain  hcl.Body `hcl:",remain"`
}

ModuleMapping is a schema for "module" block in Terraform file.

type Option

type Option func(*options)

func WithAdditionalEnvs

func WithAdditionalEnvs(shared, init, plan, apply []string) Option

func WithAdditionalFlags

func WithAdditionalFlags(shared, init, plan, apply []string) Option

func WithVarFiles

func WithVarFiles(files []string) Option

func WithVars

func WithVars(vars []string) Option

func WithoutColor

func WithoutColor() Option

type PlanResult

type PlanResult struct {
	Adds     int
	Changes  int
	Destroys int

	PlanOutput string
}

func (PlanResult) NoChanges

func (r PlanResult) NoChanges() bool

func (PlanResult) Render added in v0.42.0

func (r PlanResult) Render() string

type Terraform

type Terraform struct {
	// contains filtered or unexported fields
}

func NewTerraform

func NewTerraform(execPath, dir string, opts ...Option) *Terraform

func (*Terraform) Apply

func (t *Terraform) Apply(ctx context.Context, w io.Writer) error

func (*Terraform) Init

func (t *Terraform) Init(ctx context.Context, w io.Writer) error

func (*Terraform) Plan

func (t *Terraform) Plan(ctx context.Context, w io.Writer) (PlanResult, error)

func (*Terraform) SelectWorkspace

func (t *Terraform) SelectWorkspace(ctx context.Context, workspace string) error

func (*Terraform) Version

func (t *Terraform) Version(ctx context.Context) (string, error)

Jump to

Keyboard shortcuts

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