Documentation ¶
Index ¶
- func Sort(getter moduleGetter) func(*Workspace, *Workspace) int
- func TerraformEnv(workspaceName string) string
- type CostSummary
- type ListOptions
- type ReloadSummary
- type Service
- func (s Service) Cost(workspaceIDs ...resource.ID) (task.Spec, error)
- func (s *Service) Create(path, name string) (task.Spec, error)
- func (s *Service) Delete(workspaceID resource.ID) (task.Spec, error)
- func (s *Service) Get(workspaceID resource.ID) (*Workspace, error)
- func (s *Service) GetByName(modulePath, name string) (*Workspace, error)
- func (s *Service) List(opts ListOptions) []*Workspace
- func (s *Service) LoadWorkspacesUponInit(sub <-chan resource.Event[*task.Task])
- func (s *Service) LoadWorkspacesUponModuleLoad(sub <-chan resource.Event[*module.Module])
- func (r Service) Reload(moduleID resource.ID) (task.Spec, error)
- func (s *Service) SelectWorkspace(moduleID, workspaceID resource.ID) error
- type ServiceOptions
- type Workspace
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Sort ¶
Sort sorts workspaces accordingly:
1. first by their module path, lexicographically. 2. then, if module paths are equal, then by their workspace name, lexicographically
func TerraformEnv ¶
Types ¶
type CostSummary ¶ added in v0.5.0
type CostSummary float64
func (CostSummary) String ¶ added in v0.5.0
func (c CostSummary) String() string
type ListOptions ¶
type ReloadSummary ¶ added in v0.5.0
func (ReloadSummary) LogValue ¶ added in v0.5.0
func (s ReloadSummary) LogValue() slog.Value
func (ReloadSummary) String ¶ added in v0.5.0
func (s ReloadSummary) String() string
type Service ¶
func NewService ¶
func NewService(opts ServiceOptions) *Service
func (Service) Cost ¶ added in v0.5.0
Cost creates a task that retrieves a breakdown of the costs of the infrastructure deployed by the workspace.
func (*Service) List ¶
func (s *Service) List(opts ListOptions) []*Workspace
func (*Service) LoadWorkspacesUponInit ¶ added in v0.5.0
LoadWorkspacesUponInit automatically loads workspaces for a module whenever it is successfully initialized and the module does not yet have a current workspace.
func (*Service) LoadWorkspacesUponModuleLoad ¶
LoadWorkspacesUponModuleLoad automatically loads workspaces for a module loaded into pug.
func (Service) Reload ¶
Reload returns a task spec that runs `terraform workspace list` on a module and updates pug with the results, adding any newly discovered workspaces and pruning any workspaces no longer found to exist.
TODO: separate into Load and Reload
func (*Service) SelectWorkspace ¶
SelectWorkspace runs the `terraform workspace select <workspace_name>` command, which sets the current workspace for the module. Once that's finished it then updates the current workspace in pug itself too.