state

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2024 License: MPL-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StateFileResourceInstanceTainted StateFileResourceInstanceStatus = "tainted"
	StateFileResourceDataMode        StateFileResourceMode           = "data"
)

Variables

This section is empty.

Functions

func Sort

func Sort(i, j *Resource) int

Types

type ReloadSummary added in v0.5.0

type ReloadSummary int
const (
	Empty ReloadSummary = iota
	Unchanged
	Updated
)

func (ReloadSummary) String added in v0.5.0

func (s ReloadSummary) String() string

type Resource

type Resource struct {
	resource.Common

	Address    ResourceAddress
	Attributes map[string]any
	Tainted    bool
}

Resource is a pug state resource.

func (*Resource) String added in v0.2.0

func (r *Resource) String() string

type ResourceAddress

type ResourceAddress string

type Service

type Service struct {
	*pubsub.Broker[*State]
	// contains filtered or unexported fields
}

func NewService

func NewService(opts ServiceOptions) *Service

func (*Service) CreateReloadTask added in v0.5.0

func (s *Service) CreateReloadTask(workspaceID resource.ID) (*task.Task, error)

func (*Service) Delete

func (s *Service) Delete(workspaceID resource.ID, addrs ...ResourceAddress) (task.Spec, error)

func (*Service) Get

func (s *Service) Get(workspaceID resource.ID) (*State, error)

Get retrieves the state for a workspace.

func (*Service) GetResource added in v0.3.4

func (s *Service) GetResource(resourceID resource.ID) (*Resource, error)

GetResource retrieves a state resource.

TODO: this is massively inefficient

func (*Service) Move added in v0.1.10

func (s *Service) Move(workspaceID resource.ID, src, dest ResourceAddress) (task.Spec, error)

func (Service) Reload

func (r Service) Reload(workspaceID resource.ID) (task.Spec, error)

Reload creates a task to repopulate the local cache of the state of the given workspace.

func (*Service) Taint

func (s *Service) Taint(workspaceID resource.ID, addr ResourceAddress) (task.Spec, error)

func (*Service) Untaint

func (s *Service) Untaint(workspaceID resource.ID, addr ResourceAddress) (task.Spec, error)

type ServiceOptions

type ServiceOptions struct {
	Modules    *module.Service
	Workspaces *workspace.Service
	Tasks      *task.Service
	Logger     logging.Interface
}

type State

type State struct {
	resource.Common

	WorkspaceID      resource.ID
	Resources        map[ResourceAddress]*Resource
	Serial           int64
	TerraformVersion string
	Lineage          string
}

func (*State) LogValue added in v0.2.0

func (s *State) LogValue() slog.Value

type StateFile

type StateFile struct {
	Version          int
	TerraformVersion string `json:"terraform_version"`
	Serial           int64
	Lineage          string
	Outputs          map[string]StateFileOutput
	Resources        []StateFileResource
}

StateFile is the terraform state file contents

type StateFileModule

type StateFileModule struct {
	Resources    []StateFileResource
	ChildModules []StateFileModule `json:"child_modules"`
}

type StateFileOutput

type StateFileOutput struct {
	Value     json.RawMessage
	Sensitive bool
}

StateFileOutput is an output in the terraform state file

type StateFileResource

type StateFileResource struct {
	Name        string
	ProviderURI string `json:"provider"`
	Type        string
	Module      string
	Mode        StateFileResourceMode
	Instances   []StateFileResourceInstance
}

type StateFileResourceInstance added in v0.2.0

type StateFileResourceInstance struct {
	IndexKey   any `json:"index_key"`
	Status     StateFileResourceInstanceStatus
	Attributes json.RawMessage
}

type StateFileResourceInstanceStatus added in v0.2.0

type StateFileResourceInstanceStatus string

type StateFileResourceMode added in v0.2.0

type StateFileResourceMode string

Jump to

Keyboard shortcuts

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