state

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2024 License: MPL-2.0 Imports: 13 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 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) Delete

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

func (*Service) Get

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

Get retrieves the state for a workspace.

func (*Service) Move added in v0.1.10

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

func (*Service) Reload

func (s *Service) Reload(workspaceID resource.ID) (*task.Task, 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.Task, error)

func (*Service) Untaint

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

type ServiceOptions

type ServiceOptions struct {
	ModuleService    *module.Service
	WorkspaceService *workspace.Service
	TaskService      *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   *int `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