Documentation
¶
Overview ¶
Package iac provides the Infrastructure-as-Code plugin framework.
Index ¶
- Variables
- func Register(name string, factory Factory)
- type ApplyResult
- type ChangeAction
- type ChangeSummary
- type Factory
- type ImportMapping
- type ImportOptions
- type ImportResult
- type OutputValue
- type Plugin
- type PreviewResult
- type PropertyDiff
- type RefreshResult
- type Registry
- type ResourceChange
- type ResourceDrift
- type RunOptions
- type VolumeMount
Constants ¶
This section is empty.
Variables ¶
var DefaultRegistry = &Registry{ factories: make(map[string]Factory), }
DefaultRegistry is the global plugin registry.
Functions ¶
Types ¶
type ApplyResult ¶
type ApplyResult struct {
Outputs map[string]OutputValue
State []byte // Serialized state for persistence
// PartialError is set if apply partially succeeded
PartialError error
}
ApplyResult contains the result of an apply operation.
type ChangeAction ¶
type ChangeAction string
ChangeAction indicates the type of change.
const ( ActionCreate ChangeAction = "create" ActionUpdate ChangeAction = "update" ActionDelete ChangeAction = "delete" ActionReplace ChangeAction = "replace" ActionNoop ChangeAction = "noop" )
type ChangeSummary ¶
ChangeSummary summarizes planned changes.
type ImportMapping ¶
type ImportMapping struct {
// Address is the IaC-module-internal resource address (e.g., "aws_db_instance.main")
Address string
// ID is the real cloud resource ID (e.g., "mydb-instance-123")
ID string
}
ImportMapping maps an IaC resource address to a cloud resource ID.
type ImportOptions ¶
type ImportOptions struct {
// ModuleSource is the OCI image reference or local path to the module
ModuleSource string
// ModulePath is the path within the module (for local modules)
ModulePath string
// Inputs are the values passed to the module
Inputs map[string]interface{}
// Mappings are the resource address to cloud ID mappings
Mappings []ImportMapping
// WorkDir is the working directory for execution
WorkDir string
// Environment contains environment variables for the execution
Environment map[string]string
// Stdout/Stderr for command output
Stdout io.Writer
Stderr io.Writer
}
ImportOptions configures an import operation.
type ImportResult ¶
type ImportResult struct {
// Outputs extracted from the imported state
Outputs map[string]OutputValue
// State is the serialized IaC state after import
State []byte
// ImportedResources lists the addresses that were successfully imported
ImportedResources []string
}
ImportResult contains the result of an import operation.
type OutputValue ¶
type OutputValue struct {
Value interface{}
Sensitive bool
}
OutputValue represents a module output.
type Plugin ¶
type Plugin interface {
// Name returns the plugin identifier (e.g., "pulumi", "opentofu", "native")
Name() string
// Preview generates a preview of changes without applying
Preview(ctx context.Context, opts RunOptions) (*PreviewResult, error)
// Apply applies the module and returns outputs
Apply(ctx context.Context, opts RunOptions) (*ApplyResult, error)
// Destroy destroys resources created by the module
Destroy(ctx context.Context, opts RunOptions) error
// Refresh refreshes state without applying changes
Refresh(ctx context.Context, opts RunOptions) (*RefreshResult, error)
// Import adopts existing cloud resources into the module's state.
// Each ImportMapping maps an IaC-internal resource address to a real cloud
// resource ID. After importing, the plugin extracts outputs from the
// resulting state so cldctl can record them.
Import(ctx context.Context, opts ImportOptions) (*ImportResult, error)
}
Plugin defines the interface for IaC framework plugins.
type PreviewResult ¶
type PreviewResult struct {
Changes []ResourceChange
Summary ChangeSummary
}
PreviewResult contains the result of a preview operation.
type PropertyDiff ¶
PropertyDiff describes a change to a property.
type RefreshResult ¶
type RefreshResult struct {
State []byte
Drifts []ResourceDrift
}
RefreshResult contains the result of a refresh operation.
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry manages plugin factories.
type ResourceChange ¶
type ResourceChange struct {
ResourceID string
ResourceType string
Action ChangeAction // Create, Update, Delete, Replace
Before interface{} // Current state (nil for create)
After interface{} // Planned state (nil for delete)
Diff []PropertyDiff
}
ResourceChange describes a planned change to a resource.
type ResourceDrift ¶
type ResourceDrift struct {
ResourceID string
ResourceType string
Diffs []PropertyDiff
}
ResourceDrift describes drift between state and actual infrastructure.
type RunOptions ¶
type RunOptions struct {
// ModuleSource is the OCI image reference or local path to the module
ModuleSource string
// ModulePath is the path within the module (for local modules)
ModulePath string
// Inputs are the values passed to the module
Inputs map[string]interface{}
// StateReader provides existing state (nil for new deployments)
StateReader io.Reader
// StateWriter receives the updated state after apply
StateWriter io.Writer
// WorkDir is the working directory for execution
WorkDir string
// Environment contains environment variables for the execution
Environment map[string]string
// Volumes are volume mounts needed by the module (e.g., Docker socket)
Volumes []VolumeMount
// Stdout/Stderr for command output
Stdout io.Writer
Stderr io.Writer
// OnProgress reports sub-status updates during long-running operations
// (e.g., "pulling image...", "health check 5/30"). May be nil.
OnProgress func(message string)
}
RunOptions configures a plugin execution.
type VolumeMount ¶
VolumeMount defines a volume mount for module execution.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package container implements container-based IaC module execution.
|
Package container implements container-based IaC module execution. |
|
entrypoint
command
Package main implements the cldctl module entrypoint.
|
Package main implements the cldctl module entrypoint. |
|
Package native implements a native IaC plugin for Docker and process execution.
|
Package native implements a native IaC plugin for Docker and process execution. |
|
Package opentofu implements an IaC plugin for OpenTofu/Terraform.
|
Package opentofu implements an IaC plugin for OpenTofu/Terraform. |
|
Package pulumi implements an IaC plugin for Pulumi.
|
Package pulumi implements an IaC plugin for Pulumi. |