terraform

package
v1.12.8 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2021 License: MIT Imports: 11 Imported by: 1

Documentation

Overview

Package terraform implements methods and functions for running Terraform commands, such as terraform init/plan/apply.

The intention of this package is to call and run inside a CI/CD pipeline.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CmdOutput

type CmdOutput struct {
	Stdout   string
	Stderr   string
	ExitCode int
}

CmdOutput has the Stout and Stderr

type Commander

type Commander struct {
	AccessKeyID     string
	SecretAccessKey string
	Workspace       string
	VarFile         string
	DisplayTfOutput bool
	BulkTfPaths     string
	// contains filtered or unexported fields
}

Commander struct holds all data required to execute terraform.

func (*Commander) Apply

func (s *Commander) Apply() error

Apply executes terraform apply.

func (*Commander) BulkApply

func (c *Commander) BulkApply() error

BulkApply executes teraform apply against all directories that changed in the PR.

func (*Commander) BulkPlan

func (c *Commander) BulkPlan() error

BulkPlan executes plan against all directories that changed in the PR.

func (*Commander) CheckDivergence

func (s *Commander) CheckDivergence() error

CheckDivergence check that there are not changes within certain state, if there are it will return non-zero and pipeline will fail.

func (*Commander) Init

func (s *Commander) Init(p bool) error

Init executes terraform init.

func (*Commander) Kubectl

func (s *Commander) Kubectl(args ...string) (*CmdOutput, error)

Kubectl creates kubectl command to be executed

func (*Commander) Plan

func (s *Commander) Plan() error

Plan executes terraform plan

func (*Commander) SelectWs

func (s *Commander) SelectWs(ws string) error

SelectWs is used to select certain workspace.

func (*Commander) Terraform

func (s *Commander) Terraform(args ...string) (*CmdOutput, error)

Terraform creates terraform command to be executed

Jump to

Keyboard shortcuts

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