tfcli

package module
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: May 17, 2022 License: MIT Imports: 15 Imported by: 0

README

Terraform CLI Wrapper

GoDoc Test

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DownloadTerraform

func DownloadTerraform(version string, force bool) (string, error)

DownloadTerraform downloads the terraform binary for the given version from the official source.

Types

type RegistryCredential

type RegistryCredential struct {
	Type  string `hcl:"type,label"`
	Token string `hcl:"token"`
}

RegistryCredential defines a registry credential pair

type Terraform

type Terraform interface {
	Init() error
	Apply() error
	ApplyWithPlan(planFile string) error
	Plan(planFile string) error
	Destroy() error
	Output() (map[string]string, error)
	Dir() string
	WithRegistry(credentials []RegistryCredential)
	GetModule(moduleSource, version string) error
	WithBackendVars(backendVars map[string]string)
	BackendVars() map[string]string
	AppendBackendVars(backendVars map[string]string)
	WithVars(vars map[string]string)
	Vars() map[string]string
	AppendVars(vars map[string]string)
	WithEnv(env map[string]string)
	Env() map[string]string
	AppendEnv(env map[string]string)
	ConfigFilePath() string
	Version() (string, error)
	SetStdout(stdout io.Writer) Terraform
	Stderr() io.Writer
	Stdout() io.Writer
	SetStderr(stderr io.Writer) Terraform

	SetDir(dir string) Terraform
}

Terraform interface

func New

func New(tfBin, dir string) Terraform

New creates a new Terraform cli instance.

tfBin - File path to terraform binary to use
dir - Working directory used for terraform execution
stdout - default stdout for terraform execution
stderr - default stderr for terraform execution

type Version

type Version struct {
	Version string `json:"terraform_version"`
}

Version version

Jump to

Keyboard shortcuts

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