module

package
v0.1.11 Latest Latest
Warning

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

Go to latest
Published: May 13, 2024 License: MPL-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ByPath

func ByPath(i, j *Module) int

Types

type Module

type Module struct {
	resource.Resource

	// Pug working directory
	Workdir internal.Workdir

	// Path relative to pug working directory
	Path string

	// The module's current workspace.
	CurrentWorkspaceID *resource.ID

	// Whether module is initialized correctly. Nil means it is unknown.
	Initialized *bool
	// Whether a terraform init is in progress.
	InitInProgress bool

	// Whether module is formatted correctly. Nil means it is unknown.
	Formatted *bool
	// Whether formatting is in progress.
	FormatInProgress bool

	// Whether module is valid. Nil means it is unknown.
	Valid *bool
	// Whether validation is in progress.
	ValidationInProgress bool
}

Module is a terraform root module.

func New

func New(workdir internal.Workdir, path string) *Module

New constructs a module. Workdir is the pug working directory, and path is the module path relative to the working directory.

func (*Module) FullPath

func (m *Module) FullPath() string

FullPath returns the absolute path to the module.

func (*Module) LogValue

func (m *Module) LogValue() slog.Value

type Service

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

func NewService

func NewService(opts ServiceOptions) *Service

func (*Service) CreateTask

func (s *Service) CreateTask(mod *Module, opts task.CreateOptions) (*task.Task, error)

func (*Service) Format

func (s *Service) Format(moduleID resource.ID) (*task.Task, error)

func (*Service) Get

func (s *Service) Get(id resource.ID) (*Module, error)

func (*Service) GetByPath

func (s *Service) GetByPath(path string) (*Module, error)

func (*Service) Init

func (s *Service) Init(moduleID resource.ID) (*task.Task, error)

Init invokes terraform init on the module.

func (*Service) List

func (s *Service) List() []*Module

func (*Service) Reload

func (s *Service) Reload() (added []string, removed []string, err error)

Reload searches the working directory recursively for modules and adds them to the store before pruning those that are currently stored but can no longer be found.

func (*Service) SetCurrent

func (s *Service) SetCurrent(moduleID, workspaceID resource.ID) error

func (*Service) Validate

func (s *Service) Validate(moduleID resource.ID) (*task.Task, error)

type ServiceOptions

type ServiceOptions struct {
	TaskService *task.Service
	Workdir     internal.Workdir
	PluginCache bool
	Logger      logging.Interface
}

Jump to

Keyboard shortcuts

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