Help us shape the future of Go! Take the 2026 Go Developer Survey

tfstate

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2026 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Package tfstate reads and writes the OpenTofu state meshStack keeps for a building block, and serves it to tofu's http backend.

Index

Constants

This section is empty.

Variables

View Source
var ErrNoState = errors.New("no state")

ErrNoState is meshStack's 404, which tofu's http backend takes for a state not written yet.

View Source
var ErrReadOnly = errors.New("the state is read-only")

Functions

This section is empty.

Types

type Backups

type Backups string

func ResolveBackups

func ResolveBackups(ctx context.Context, sources setting.Sources) (Backups, error)

type Proxy

type Proxy struct {
	Store       Store
	Writable    bool
	BeforeWrite func(ctx context.Context) error
	Backups     Backups
	// OnProblem gets the error of each request that failed, because tofu prints only the status code
	// of the response.
	OnProblem func(ctx context.Context, err error)
	// contains filtered or unexported fields
}

Proxy stands between tofu and meshStack, rather than giving tofu the session's token as TF_HTTP_PASSWORD, which meshfed's TfStateRunTokenBasicAuthFilter accepts. That token can expire in the middle of an apply, and nothing would check tofu's writes against the stored state.

func (*Proxy) Serve

func (p *Proxy) Serve(ctx context.Context, run func(env []string)) (requests int, err error)

func (*Proxy) ServeHTTP

func (p *Proxy) ServeHTTP(w gohttp.ResponseWriter, r *gohttp.Request)

type Requester

type Requester interface {
	DoRequest(ctx context.Context, method, path string, opts ...http.RequestOption) ([]byte, error)
}

Requester is implemented by client.RawClient.

type Store

type Store struct {
	BuildingBlock uuid.UUID
	Workspace     string
	// contains filtered or unexported fields
}

func NewStore

func NewStore(raw Requester, workspace string, buildingBlock uuid.UUID) Store

func (Store) Delete

func (s Store) Delete(ctx context.Context) error

func (Store) Get

func (s Store) Get(ctx context.Context) ([]byte, error)

func (Store) Put

func (s Store) Put(ctx context.Context, state []byte) error

Jump to

Keyboard shortcuts

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