terraform

package
v2.10.2 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2024 License: AGPL-3.0 Imports: 39 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// TerraformVersion is the version of Terraform used internally
	// when Terraform is not available on the system.
	// NOTE: Keep this in sync with the version in scripts/Dockerfile.base.
	// NOTE: Keep this in sync with the version in install.sh.
	TerraformVersion = version.Must(version.NewVersion("1.6.6"))
)

Functions

func CleanStaleTerraformPlugins added in v2.2.0

func CleanStaleTerraformPlugins(ctx context.Context, cachePath string, fs afero.Fs, now time.Time, logger slog.Logger) error

CleanStaleTerraformPlugins browses the Terraform cache directory and remove stale plugins that haven't been used for a while. Additionally, it sweeps empty, old directory trees.

Sample cachePath:

/Users/john.doe/Library/Caches/coder/provisioner-1/tf
/tmp/coder/provisioner-0/tf

func FormatDiagnostic

func FormatDiagnostic(diag *tfjson.Diagnostic) string

func Install

func Install(ctx context.Context, log slog.Logger, dir string, wantVersion *version.Version) (string, error)

Install implements a thread-safe, idempotent Terraform Install operation.

func PtrInt32

func PtrInt32(number int) *int32

func Serve

func Serve(ctx context.Context, options *ServeOptions) error

Serve starts a dRPC server on the provided transport speaking Terraform provisioner.

Types

type ServeOptions

type ServeOptions struct {
	*provisionersdk.ServeOptions

	// BinaryPath specifies the "terraform" binary to use.
	// If omitted, the $PATH will attempt to find it.
	BinaryPath string
	// CachePath must not be used by multiple processes at once.
	CachePath string
	Tracer    trace.Tracer

	// ExitTimeout defines how long we will wait for a running Terraform
	// command to exit (cleanly) if the provision was stopped. This
	// happens when the provision is canceled via RPC and when the command is
	// still running after the provision stream is closed.
	//
	// This is a no-op on Windows where the process can't be interrupted.
	//
	// Default value: 3 minutes (unhanger.HungJobExitTimeout). This value should
	// be kept less than the value that Coder uses to mark hung jobs as failed,
	// which is 5 minutes (see unhanger package).
	ExitTimeout time.Duration
}

type State

type State struct {
	Resources             []*proto.Resource
	Parameters            []*proto.RichParameter
	ExternalAuthProviders []*proto.ExternalAuthProviderResource
}

func ConvertState

func ConvertState(modules []*tfjson.StateModule, rawGraph string) (*State, error)

ConvertState consumes Terraform state and a GraphViz representation produced by `terraform graph` to produce resources consumable by Coder. nolint:gocognit // This function makes more sense being large for now, until refactored.

Jump to

Keyboard shortcuts

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