backend

package
v1.235.0 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2026 License: Apache-2.0 Imports: 17 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package backend generates Terraform backend configuration files.

Index

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

func RemoveHostBackend(directory string) error

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

func WillRemoveHostBackend(directory, path string) bool

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").

Jump to

Keyboard shortcuts

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