tfpath

package
v2.29.1 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2025 License: AGPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ReadmeFile is the location we look for to extract documentation from template versions.
	ReadmeFile = "README.md"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Layout

type Layout string

Layout is the terraform execution working directory structure. It also contains some methods for common file operations within that layout. Such as "Cleanup" and "ExtractArchive". TODO: Maybe we should include the afero.FS here as well, then all operations would be on the same FS?

func FromWorkingDirectory

func FromWorkingDirectory(workDir string) Layout

func Session

func Session(parentDirPath, sessionID string) Layout

Session creates a directory structure layout for terraform execution. The SessionID is a unique value for creating an ephemeral working directory inside the parentDirPath. All helper functions will return paths for various terraform asserts inside this working directory.

func (Layout) CleanStaleSessions

func (l Layout) CleanStaleSessions(ctx context.Context, logger slog.Logger, fs afero.Fs, now time.Time) error

CleanStaleSessions browses the work directory searching for stale session directories. Coder provisioner is supposed to remove them once after finishing the provisioning, but there is a risk of keeping them in case of a failure.

func (Layout) Cleanup

func (l Layout) Cleanup(ctx context.Context, logger slog.Logger, fs afero.Fs)

Cleanup removes the work directory and all of its contents.

func (Layout) ExtractArchive

func (l Layout) ExtractArchive(ctx context.Context, logger slog.Logger, fs afero.Fs, cfg *proto.Config) error

func (Layout) ModulesDirectory

func (l Layout) ModulesDirectory() string

func (Layout) ModulesFilePath

func (l Layout) ModulesFilePath() string

func (Layout) PlanFilePath

func (l Layout) PlanFilePath() string

func (Layout) ReadmeFilePath

func (l Layout) ReadmeFilePath() string

func (Layout) StateFilePath

func (l Layout) StateFilePath() string

func (Layout) TerraformLockFile

func (l Layout) TerraformLockFile() string

func (Layout) TerraformMetadataDir

func (l Layout) TerraformMetadataDir() string

func (Layout) WorkDirectory

func (l Layout) WorkDirectory() string

WorkDirectory returns the root working directory for Terraform files.

type Layouter

type Layouter interface {
	WorkDirectory() string
	StateFilePath() string
	PlanFilePath() string
	TerraformLockFile() string
	ReadmeFilePath() string
	TerraformMetadataDir() string
	ModulesDirectory() string
	ModulesFilePath() string
	ExtractArchive(ctx context.Context, logger slog.Logger, fs afero.Fs, cfg *proto.Config) error
	Cleanup(ctx context.Context, logger slog.Logger, fs afero.Fs)
	CleanStaleSessions(ctx context.Context, logger slog.Logger, fs afero.Fs, now time.Time) error
}

Directories

Path Synopsis
x

Jump to

Keyboard shortcuts

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