Documentation
¶
Index ¶
- type Options
- type PreviewOpts
- type PreviewResult
- type ResourceChange
- type StateBackend
- type UpOpts
- type UpResult
- type Workspace
- func (w *Workspace) Destroy(ctx context.Context) error
- func (w *Workspace) DestroyPreview(ctx context.Context) (*PreviewResult, error)
- func (w *Workspace) EncryptionSalt(ctx context.Context) (string, error)
- func (w *Workspace) ExportState(ctx context.Context) ([]byte, error)
- func (w *Workspace) ImportState(ctx context.Context, stateJSON []byte) error
- func (w *Workspace) Outputs(ctx context.Context) (map[string]any, error)
- func (w *Workspace) Preview(ctx context.Context, opts *PreviewOpts) (*PreviewResult, error)
- func (w *Workspace) SetEncryptionSalt(ctx context.Context, salt string) error
- func (w *Workspace) StateDir() string
- func (w *Workspace) Up(ctx context.Context, opts *UpOpts) (*UpResult, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Options ¶
type Options struct {
WorkDir string
StackName string
Runtime string
Config map[string]string
EnvVars map[string]string
StateBackend *StateBackend
Logger *zap.Logger
}
Options configures a Pulumi workspace.
type PreviewOpts ¶ added in v0.19.915
type PreviewOpts struct {
// PlanOutPath, if set, makes Pulumi save an update plan to this path so
// a subsequent Up can replay it deterministically.
PlanOutPath string
}
PreviewOpts are optional knobs for Preview.
type PreviewResult ¶
type PreviewResult struct {
StdOut string `json:"stdout"`
StdErr string `json:"stderr"`
ChangeSummary map[string]int `json:"change_summary"`
ResourceChanges []ResourceChange `json:"resource_changes,omitempty"`
Diagnostics []string `json:"diagnostics,omitempty"`
}
PreviewResult contains the output of a pulumi preview with structured resource changes comparable to terraform's plan JSON.
type ResourceChange ¶
type ResourceChange struct {
URN string `json:"urn"`
Type string `json:"type"`
Name string `json:"name"`
Action string `json:"action"`
Diffs []string `json:"diffs,omitempty"`
DetailedDiff map[string]apitype.PropertyDiff `json:"detailed_diff,omitempty"`
OldInputs map[string]any `json:"old_inputs,omitempty"`
NewInputs map[string]any `json:"new_inputs,omitempty"`
Provider string `json:"provider,omitempty"`
}
ResourceChange represents a single resource change in a preview, structured to mirror terraform's resource_changes for UI parity.
type StateBackend ¶
StateBackend configures the state backend for Pulumi.
type UpOpts ¶ added in v0.19.915
type UpOpts struct {
// PlanInPath, if set, makes Pulumi apply this previously-saved update
// plan instead of computing a new diff. Up will fail if reality has
// drifted from what the plan expected.
PlanInPath string
}
UpOpts are optional knobs for Up.
type UpResult ¶
type UpResult struct {
StdOut string `json:"stdout"`
StdErr string `json:"stderr"`
Outputs map[string]any `json:"outputs"`
}
UpResult contains the output of a pulumi up.
type Workspace ¶
type Workspace struct {
// contains filtered or unexported fields
}
Workspace wraps the Pulumi Automation API for programmatic Pulumi operations.
func (*Workspace) DestroyPreview ¶
func (w *Workspace) DestroyPreview(ctx context.Context) (*PreviewResult, error)
DestroyPreview generates a synthetic preview of what destroy would do by inspecting the current stack state.
func (*Workspace) EncryptionSalt ¶ added in v0.19.915
EncryptionSalt returns the stack's per-stack encryption salt. Pulumi generates this lazily the first time it encrypts a value with the passphrase secrets manager, and persists it in the stack config file. Returns "" if no salt has been generated yet.
func (*Workspace) ExportState ¶
ExportState exports the current stack state as JSON bytes.
func (*Workspace) ImportState ¶
ImportState imports stack state from JSON bytes.
func (*Workspace) Preview ¶
func (w *Workspace) Preview(ctx context.Context, opts *PreviewOpts) (*PreviewResult, error)
Preview runs `pulumi preview` with event streaming to capture structured per-resource changes, producing output comparable to terraform plan JSON. When opts.PlanOutPath is set, a Pulumi update plan is also written to that path; pass it back via UpOpts.PlanInPath on a subsequent Up to skip the implicit re-preview and guard against drift between plan and apply.
func (*Workspace) SetEncryptionSalt ¶ added in v0.19.915
SetEncryptionSalt writes salt onto the stack's config file so that secret values encrypted under that salt elsewhere (e.g. an update plan saved by a previous job) can be decrypted here. No-op when salt is empty.