terraform

package
v0.17.0-beta Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2021 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Copyright 2017 HootSuite Media Inc.

Licensed under the Apache License, Version 2.0 (the License); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. Modified hereafter by contributors to runatlantis/atlantis.

Package terraform handles the actual running of terraform commands.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MustConstraint added in v0.2.2

func MustConstraint(v string) version.Constraints

MustConstraint will parse one or more constraints from the given constraint string. The string must be a comma-separated list of constraints. It panics if there is an error.

Types

type Client

type Client interface {
	// RunCommandWithVersion executes terraform with args in path. If v is nil,
	// it will use the default Terraform version. workspace is the Terraform
	// workspace which should be set as an environment variable.
	RunCommandWithVersion(log *logging.SimpleLogger, path string, args []string, envs map[string]string, v *version.Version, workspace string) (string, error)

	// EnsureVersion makes sure that terraform version `v` is available to use
	EnsureVersion(log *logging.SimpleLogger, v *version.Version) error
}

type DefaultClient added in v0.2.2

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

func NewClient

func NewClient(
	log *logging.SimpleLogger,
	binDir string,
	cacheDir string,
	tfeToken string,
	tfeHostname string,
	defaultVersionStr string,
	defaultVersionFlagName string,
	tfDownloadURL string,
	tfDownloader Downloader,
	usePluginCache bool) (*DefaultClient, error)

NewClient constructs a terraform client. tfeToken is an optional terraform enterprise token. defaultVersionStr is an optional default terraform version to use unless a specific version is set. defaultVersionFlagName is the name of the flag that sets the default terraform version. tfDownloader is used to download terraform versions. Will asynchronously download the required version if it doesn't exist already.

func (*DefaultClient) DefaultVersion added in v0.7.0

func (c *DefaultClient) DefaultVersion() *version.Version

Version returns the default version of Terraform we use if no other version is defined.

func (*DefaultClient) EnsureVersion added in v0.9.0

func (c *DefaultClient) EnsureVersion(log *logging.SimpleLogger, v *version.Version) error

See Client.EnsureVersion.

func (*DefaultClient) RunCommandAsync added in v0.5.0

func (c *DefaultClient) RunCommandAsync(log *logging.SimpleLogger, path string, args []string, customEnvVars map[string]string, v *version.Version, workspace string) (chan<- string, <-chan Line)

RunCommandAsync runs terraform with args. It immediately returns an input and output channel. Callers can use the output channel to get the realtime output from the command. Callers can use the input channel to pass stdin input to the command. If any error is passed on the out channel, there will be no further output (so callers are free to exit).

func (*DefaultClient) RunCommandWithVersion added in v0.2.2

func (c *DefaultClient) RunCommandWithVersion(log *logging.SimpleLogger, path string, args []string, customEnvVars map[string]string, v *version.Version, workspace string) (string, error)

See Client.RunCommandWithVersion.

func (*DefaultClient) TerraformBinDir added in v0.9.0

func (c *DefaultClient) TerraformBinDir() string

TerraformBinDir returns the directory where we download Terraform binaries.

type DefaultDownloader added in v0.6.0

type DefaultDownloader struct{}

func (*DefaultDownloader) GetAny added in v0.17.0

func (d *DefaultDownloader) GetAny(dst, src string, opts ...getter.ClientOption) error

See go-getter.GetFile.

func (*DefaultDownloader) GetFile added in v0.6.0

func (d *DefaultDownloader) GetFile(dst, src string, opts ...getter.ClientOption) error

See go-getter.GetFile.

type Downloader added in v0.6.0

type Downloader interface {
	GetFile(dst, src string, opts ...getter.ClientOption) error
	GetAny(dst, src string, opts ...getter.ClientOption) error
}

Downloader is for downloading terraform versions.

type Line added in v0.5.0

type Line struct {
	// Line is the contents of the line (without the newline).
	Line string
	// Err is set if there was an error.
	Err error
}

Line represents a line that was output from a terraform command.

Directories

Path Synopsis
matchers
Code generated by pegomock.
Code generated by pegomock.

Jump to

Keyboard shortcuts

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