Documentation
¶
Index ¶
- func GetBackendAttribute(section *map[string]any, attribute string) string
- func GetComponentBackend(sections *map[string]any) map[string]any
- func GetComponentBackendType(sections *map[string]any) string
- func GetS3BackendAssumeRoleArn(backend *map[string]any) string
- func GetTerraformBackend(atmosConfig *schema.AtmosConfiguration, componentSections *map[string]any) (map[string]any, error)
- func GetTerraformBackendReadFunc(backendType string) func(*schema.AtmosConfiguration, *map[string]any) ([]byte, error)
- func GetTerraformBackendVariable(atmosConfig *schema.AtmosConfiguration, values map[string]any, variable string) (any, error)
- func GetTerraformComponent(sections *map[string]any) string
- func GetTerraformWorkspace(sections *map[string]any) string
- func ProcessTerraformStateFile(data []byte) (map[string]any, error)
- func ReadTerraformBackendLocal(atmosConfig *schema.AtmosConfiguration, componentSections *map[string]any) ([]byte, error)
- func ReadTerraformBackendS3(atmosConfig *schema.AtmosConfiguration, componentSections *map[string]any) ([]byte, error)
- func ReadTerraformBackendS3Internal(s3Client S3API, componentSections *map[string]any, backend *map[string]any) ([]byte, error)
- func RegisterTerraformBackends()
- type RawTerraformState
- type ReadTerraformBackendFunc
- type S3API
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetBackendAttribute ¶
GetBackendAttribute returns an attribute from a section in the backend.
func GetComponentBackend ¶
GetComponentBackend returns the `backend` section for a component in a stack.
func GetComponentBackendType ¶
GetComponentBackendType returns the `backend_type` section for a component in a stack.
func GetS3BackendAssumeRoleArn ¶
GetS3BackendAssumeRoleArn returns the s3 backend role ARN from the S3 backend config. https://developer.hashicorp.com/terraform/language/backend/s3#assume-role-configuration
func GetTerraformBackend ¶
func GetTerraformBackend( atmosConfig *schema.AtmosConfiguration, componentSections *map[string]any, ) (map[string]any, error)
GetTerraformBackend reads and processes the Terraform state file from the configured backend.
func GetTerraformBackendReadFunc ¶
func GetTerraformBackendReadFunc(backendType string) func(*schema.AtmosConfiguration, *map[string]any) ([]byte, error)
GetTerraformBackendReadFunc accepts a backend type and returns a function to read the state file from the backend.
func GetTerraformBackendVariable ¶
func GetTerraformBackendVariable( atmosConfig *schema.AtmosConfiguration, values map[string]any, variable string, ) (any, error)
GetTerraformBackendVariable returns the output from the configured backend.
func GetTerraformComponent ¶
GetTerraformComponent returns the `component` section for a component in a stack.
func GetTerraformWorkspace ¶
GetTerraformWorkspace returns the `workspace` section for a component in a stack.
func ProcessTerraformStateFile ¶
ProcessTerraformStateFile processes a Terraform state file.
func ReadTerraformBackendLocal ¶
func ReadTerraformBackendLocal( atmosConfig *schema.AtmosConfiguration, componentSections *map[string]any, ) ([]byte, error)
ReadTerraformBackendLocal reads the Terraform state file from the local backend. If the state file does not exist, the function returns `nil`.
func ReadTerraformBackendS3 ¶
func ReadTerraformBackendS3( atmosConfig *schema.AtmosConfiguration, componentSections *map[string]any, ) ([]byte, error)
ReadTerraformBackendS3 reads the Terraform state file from the configured S3 backend. If the state file does not exist in the bucket, the function returns `nil`.
func ReadTerraformBackendS3Internal ¶
func ReadTerraformBackendS3Internal( s3Client S3API, componentSections *map[string]any, backend *map[string]any, ) ([]byte, error)
ReadTerraformBackendS3Internal accepts an S3 client and reads the Terraform state file from the configured S3 backend.
func RegisterTerraformBackends ¶
func RegisterTerraformBackends()
RegisterTerraformBackends registers Terraform backends.
Types ¶
type RawTerraformState ¶
type RawTerraformState struct {
Version int `json:"version"` // Internal format version
TerraformVersion string `json:"terraform_version"` // CLI version used
Outputs map[string]struct {
Value any `json:"value"` // Can be any JSON type
Type any `json:"type"` // HCL type representation
} `json:"outputs"`
Resources interface{} `json:"resources,omitempty"`
}
RawTerraformState represents a raw Terraform state file.
type ReadTerraformBackendFunc ¶
ReadTerraformBackendFunc defines a function type to read Terraform state from a backend.