tfpath

package
v2.31.6 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2026 License: AGPL-3.0 Imports: 13 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 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, templateSourceArchive, modulesArchive []byte) error

ExtractArchive extracts the provided template source archive and modules archive into the working directory. `modulesArchive` is optional and can be nil or empty.

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.

Jump to

Keyboard shortcuts

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