Documentation
¶
Overview ¶
Package backend generates Terraform backend configuration files.
Index ¶
- func Config(backendType string, backendConfig map[string]any, terraformWorkspace string) (map[string]any, error)
- func GenerateFile(atmosConfig *schema.AtmosConfiguration, info *schema.ConfigAndStacksInfo, ...) error
- func HostBackendPaths() []string
- func RemoveHostBackend(directory string) error
- func WillRemoveHostBackend(directory, path string) bool
- type FileOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Config ¶
func Config(backendType string, backendConfig map[string]any, terraformWorkspace string) (map[string]any, error)
Config builds Terraform backend configuration, including Terraform Cloud workspace tokens.
func GenerateFile ¶
func GenerateFile( atmosConfig *schema.AtmosConfiguration, info *schema.ConfigAndStacksInfo, workingDir string, opts ...FileOption, ) error
GenerateFile writes backend.tf.json when enabled, except for Terraform test runs. Existing files are preserved when generation is skipped.
func HostBackendPaths ¶
func HostBackendPaths() []string
HostBackendPaths lists the files RemoveHostBackend may remove, relative to the working directory.
func RemoveHostBackend ¶
RemoveHostBackend removes only the unchanged file recorded by the host writer. Older, unrecorded backends remain user-owned: never infer ownership from a name or matching backend settings. Terraform will reject any remaining duplicate.
func WillRemoveHostBackend ¶
WillRemoveHostBackend reports whether RemoveHostBackend would remove the named file: it is the host backend, its receipt exists, and the bytes still match what the host wrote. Any other state, including an unreadable one, is not provably removable.
Types ¶
type FileOption ¶
type FileOption func(*fileOptions)
FileOption configures GenerateFile.
func WithOpenTofuDetector ¶
func WithOpenTofuDetector(detect func() bool) FileOption
WithOpenTofuDetector sets how GenerateFile tells OpenTofu from Terraform. Without it, the configured command's name decides (it contains "tofu").