terraform

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2026 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FieldNameTfPath         = "terraform_path"
	FieldNameTfBinary       = "terraform_binary"
	FieldNameTfBinarySHA256 = "terraform_binary_sha256"

	StorageKeyConfiguration = "terraform_configuration"
)
View Source
const (
	// StorageKeyTerraformState is the key for storing terraform state in storage
	StorageKeyTerraformState = "terraform_state"
)

Variables

This section is empty.

Functions

func ApplyTerraformFromFS added in v0.2.0

func ApplyTerraformFromFS(ctx context.Context, worktreeFS billy.Filesystem, config CLIConfig) error

ApplyTerraformFromFS extracts terraform files from the given filesystem and applies them using Terraform CLI.

Directory layout inside tmpDir:

tmpDir/
├── workspace/   ← .tf files extracted here (CWD for terraform)
└── .rootfs/     ← sandbox skeleton (only in sandboxed mode)

Files under config.TfPath are extracted directly into workspace/ without the prefix, so terraform always runs from workspace/. The .rootfs sibling is derived from workDir by newSandboxedCommand and never appears inside /workspace after pivot_root.

func Paths

func Paths(baseBackend *framework.Backend) []*framework.Path

func ResolveAndValidateTfBinary added in v0.1.4

func ResolveAndValidateTfBinary(tfBinary, expectedSHA256 string) (string, error)

ResolveAndValidateTfBinary resolves the terraform binary path, validates that it exists, is a regular file with execute permission, and optionally matches the expected SHA256. Empty tfBinary is treated as "terraform". Returns the absolute path to the binary or an error.

Types

type CLIConfig

type CLIConfig struct {
	VaultAddr        string
	VaultToken       string
	VaultNamespace   string
	VaultCACertBytes string
	TfPath           string
	TfBinary         string
	TfBinarySHA256   string
	Storage          logical.Storage
	Logger           hclog.Logger
}

CLIConfig contains configuration for terraform CLI execution

type Configuration

type Configuration struct {
	TfPath         string `structs:"terraform_path" json:"terraform_path,omitempty"`
	TfBinary       string `structs:"terraform_binary" json:"terraform_binary,omitempty"`
	TfBinarySHA256 string `structs:"terraform_binary_sha256" json:"terraform_binary_sha256,omitempty"`
}

func GetConfig

func GetConfig(ctx context.Context, storage logical.Storage) (*Configuration, error)

GetConfig returns the configuration for use in other packages

Jump to

Keyboard shortcuts

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