Documentation
¶
Index ¶
- Constants
- type Layout
- func (l Layout) CleanStaleSessions(ctx context.Context, logger slog.Logger, fs afero.Fs, now time.Time) error
- func (l Layout) Cleanup(ctx context.Context, logger slog.Logger, fs afero.Fs)
- func (l Layout) ExtractArchive(ctx context.Context, logger slog.Logger, fs afero.Fs, cfg *proto.Config) error
- func (l Layout) ModulesDirectory() string
- func (l Layout) ModulesFilePath() string
- func (l Layout) PlanFilePath() string
- func (l Layout) ReadmeFilePath() string
- func (l Layout) StateFilePath() string
- func (l Layout) TerraformLockFile() string
- func (l Layout) TerraformMetadataDir() string
- func (l Layout) WorkDirectory() string
- type Layouter
Constants ¶
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 Session ¶
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) ExtractArchive ¶
func (Layout) ModulesDirectory ¶
func (Layout) ModulesFilePath ¶
func (Layout) PlanFilePath ¶
func (Layout) ReadmeFilePath ¶
func (Layout) StateFilePath ¶
func (Layout) TerraformLockFile ¶
func (Layout) TerraformMetadataDir ¶
func (Layout) WorkDirectory ¶
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
}