workspace

package
v0.24.0 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2022 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsNoTfVersionSelected

func IsNoTfVersionSelected(err error) bool

IsNoTfVersionSelected answer if an error's cause is that no terraform version has been selected.

func IsVersionSelectionNotFound added in v0.19.0

func IsVersionSelectionNotFound(err error) bool

IsVersionSelectionNotFound answers if an error means that no .terraform-version file could be found.

func ReadSingleLineFrom added in v0.19.0

func ReadSingleLineFrom(fileReader io.Reader) (string, error)

ReadSingleLineFrom reads a single line, in case of multiples the last one, with comment lines (starting with #) or empty ones being skipped

Types

type Config added in v0.19.0

type Config struct {
	Sources []string
	Verbose bool `ini:"verbose"`
}

Config is the tfvm config.

type SelectionSourceType

type SelectionSourceType int

SelectionSourceType describes the method how a TerraformVersionSelection is selected.

const (
	// File means the terraform version is selected via a .terraform-version file.
	File SelectionSourceType = 0
	// Env means the terraform version is selected via a env variable.
	Env SelectionSourceType = 1
)

type TerraformVersionSelection

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

TerraformVersionSelection describes the result of version selection.

func (*TerraformVersionSelection) Source

func (config *TerraformVersionSelection) Source() string

Source gives the source of version section.

func (*TerraformVersionSelection) VersionSpec

VersionSpec returns the version specification in the TerraformVersionSelection.

type Workspace

type Workspace struct {
	RootDir string
	Config  *Config
}

Workspace represents a workspace, that possibly contains a .terraform-version file with a terraform version selection.

func GetWorkspace

func GetWorkspace() (*Workspace, error)

GetWorkspace returns an initialized workspace instance.

func (*Workspace) GetConfig added in v0.19.0

func (workspace *Workspace) GetConfig() *Config

GetConfig returns the config of a workspace.

func (*Workspace) GetTerraformVersionSelection

func (workspace *Workspace) GetTerraformVersionSelection() (*TerraformVersionSelection, error)

GetTerraformVersionSelection get the terraform version selection in a workspace.

func (*Workspace) WriteTerraformVersionSelection added in v0.16.0

func (workspace *Workspace) WriteTerraformVersionSelection(tfVersionSelection string) error

WriteTerraformVersionSelection writes a terraform selection to a .terraform-version file.

Jump to

Keyboard shortcuts

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