Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Checker ¶
type Checker interface {
// CheckDrift checks the drift of all resources in the blueprint
// with the given instance ID.
// This will always check the drift with the upstream provider,
// the state container can be used to retrieve the last known
// drift state that was previously checked.
// In most cases, this method will persist the results of the
// drift check with the configured state container.
// This returns a map of resource IDs to their drift state ONLY
// if the resource has drifted from the last known state.
CheckDrift(
ctx context.Context,
instanceID string,
params core.BlueprintParams,
taggingConfig *provider.TaggingConfig,
) (map[string]*state.ResourceDriftState, error)
// CheckResourceDrift checks the drift of a single resource
// with the given instance ID and resource ID.
// This will always check the drift with the upstream provider,
// the state container can be used to retrieve the last known
// drift state that was previously checked.
// In most cases, this method will persist the results of the
// drift check with the configured state container.
// This will return nil if the resource has not drifted from
// the last known state.
CheckResourceDrift(
ctx context.Context,
instanceID string,
instanceName string,
resourceID string,
params core.BlueprintParams,
taggingConfig *provider.TaggingConfig,
) (*state.ResourceDriftState, error)
// CheckInterruptedResources detects interrupted resources and determines
// their actual state from the cloud, but does NOT update persisted state.
// Returns results for user review before applying reconciliation.
// This is typically called during change staging to allow users to
// review and approve state updates for resources that were interrupted
// during a previous deployment.
CheckInterruptedResources(
ctx context.Context,
instanceID string,
params core.BlueprintParams,
taggingConfig *provider.TaggingConfig,
) ([]ReconcileResult, error)
// ApplyReconciliation updates persisted state based on reconcile results.
// This should be called after the user approves the reconciliation.
ApplyReconciliation(
ctx context.Context,
results []ReconcileResult,
) error
// CheckLinkDrift checks drift for a single link.
// Uses ResourceDataMappings to compare link.Data against resource external state.
// Also checks intermediary resources via GetIntermediaryExternalState.
// This will persist the results of the drift check with the configured state container.
// Returns nil if the link has not drifted.
CheckLinkDrift(
ctx context.Context,
instanceID string,
linkID string,
params core.BlueprintParams,
taggingConfig *provider.TaggingConfig,
) (*state.LinkDriftState, error)
// CheckAllLinkDrift checks drift for all links in an instance.
// Uses ResourceDataMappings to compare link.Data against resource external state.
// Also checks intermediary resources via GetIntermediaryExternalState.
// This will persist the results of the drift check with the configured state container.
// Returns a map of link IDs to their drift state ONLY if the link has drifted.
CheckAllLinkDrift(
ctx context.Context,
instanceID string,
params core.BlueprintParams,
taggingConfig *provider.TaggingConfig,
) (map[string]*state.LinkDriftState, error)
// CheckDriftWithState is like CheckDrift but accepts pre-fetched instance state.
// Use this to avoid redundant state fetches when the caller already has the state.
CheckDriftWithState(
ctx context.Context,
instanceState *state.InstanceState,
params core.BlueprintParams,
taggingConfig *provider.TaggingConfig,
) (map[string]*state.ResourceDriftState, error)
// CheckInterruptedResourcesWithState is like CheckInterruptedResources but accepts
// pre-fetched instance state.
CheckInterruptedResourcesWithState(
ctx context.Context,
instanceState *state.InstanceState,
params core.BlueprintParams,
taggingConfig *provider.TaggingConfig,
) ([]ReconcileResult, error)
// CheckAllLinkDriftWithState is like CheckAllLinkDrift but accepts pre-fetched
// instance state.
CheckAllLinkDriftWithState(
ctx context.Context,
instanceState *state.InstanceState,
params core.BlueprintParams,
taggingConfig *provider.TaggingConfig,
) (map[string]*state.LinkDriftState, error)
}
Checker is an interface for behaviour that can be used to check if resources within a blueprint have drifted from the current state persisted with the blueprint framework. This is useful to detect situations where resources in an upstream provider (e.g. an AWS account) have been modified manually or by other means, and the blueprint state is no longer in sync with the actual state of the resources. A checker is only responsible for checking and persisting drift, the course of action to resolve the drift is left to the user.
func NewDefaultChecker ¶
func NewDefaultChecker( stateContainer state.Container, providers map[string]provider.Provider, changeGenerator changes.ResourceChangeGenerator, clock core.Clock, logger core.Logger, ) Checker
NewDefaultChecker creates a new instance of the default drift checker implementation.
type ReconcileResult ¶ added in v0.37.0
type ReconcileResult struct {
// ResourceID is the unique identifier for the resource.
ResourceID string
// ResourceName is the logical name of the resource.
ResourceName string
// ResourceType is the type of the resource (e.g., "aws/s3Bucket").
ResourceType string
// OldStatus is the status the resource had before reconciliation
// (typically an interrupted status).
OldStatus core.PreciseResourceStatus
// NewStatus is the status determined from fetching external state.
// This will be the actual status of the resource (e.g., created, create_failed).
NewStatus core.PreciseResourceStatus
// ExternalState contains the actual cloud state if the resource exists.
// This will be nil if the resource doesn't exist in the cloud.
ExternalState *core.MappingNode
// PersistedState contains what we had in our state before interruption.
PersistedState *core.MappingNode
// StateChanges shows the diff between persisted and external state.
// Generated using the same change detection as drift checking.
StateChanges *provider.Changes
}
ReconcileResult represents the result of checking an interrupted resource with full state details to allow the user to review before applying reconciliation.
func (*ReconcileResult) HasStateChanges ¶ added in v0.37.0
func (r *ReconcileResult) HasStateChanges() bool
HasStateChanges returns true if the reconcile result has detected changes between the persisted and external state.
func (*ReconcileResult) ResourceExists ¶ added in v0.37.0
func (r *ReconcileResult) ResourceExists() bool
ResourceExists returns true if the resource was found in the external state.