applying

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2026 License: MPL-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyPlannedChanges

func ApplyPlannedChanges(ctx context.Context, plan *plans.Plan, configInst *eval.ConfigInstance, plugins plugins.Plugins) (*states.State, tfdiags.Diagnostics)

ApplyPlannedChanges is a temporary placeholder entrypoint for a new approach to applying based on an execution graph generated during the planning phase.

The signature here is a little confusing because we're currently reusing our old-style plan and state models, even though their shape isn't quite right for what we need here. A future version of this function will hopefully have a signature more tailored to the needs of the new apply engine, once we have a stronger understanding of what those needs are.

func ContextWithTracer

func ContextWithTracer(parent context.Context, tracer *Tracer) context.Context

ContextWithTracer returns a new context derived from parent that carries a Tracer.

Use the resulting context when calling ApplyPlannedChanges, to get event notification callbacks throughout the planning process.

Types

type Tracer

type Tracer struct {

	// StartManagedResourceInstanceObjectFinalPlan and
	// EndManagedResourceInstanceObjectFinalPlan mark the beginning and end of
	// the work to produce the final plan for the identified managed resource
	// instance object.
	StartManagedResourceInstanceObjectFinalPlan func(ctx context.Context, addr addrs.AbsResourceInstanceObject, priorVal, configVal, expectedVal cty.Value) context.Context
	EndManagedResourceInstanceObjectFinalPlan   func(ctx context.Context, addr addrs.AbsResourceInstanceObject, priorVal, plannedVal cty.Value, diags tfdiags.Diagnostics)

	// StartManagedResourceInstanceObjectApply and
	// EndManagedResourceInstanceObjectApply mark the beginning and end of
	// the work to apply the final plan for the identified managed resource
	// instance object.
	StartManagedResourceInstanceObjectApply func(ctx context.Context, addr addrs.AbsResourceInstanceObject, priorVal, plannedVal cty.Value) context.Context
	EndManagedResourceInstanceObjectApply   func(ctx context.Context, addr addrs.AbsResourceInstanceObject, resultVal cty.Value, diags tfdiags.Diagnostics)

	// Provisioner Hooks for Managed Resources
	StartProvisionInstanceStep func(ctx context.Context, addr addrs.AbsResourceInstance, typeName string) context.Context
	ProvisionOutput            func(ctx context.Context, addr addrs.AbsResourceInstance, typeName string, line string, configMarks cty.ValueMarks)
	StopProvisionInstanceStep  func(ctx context.Context, addr addrs.AbsResourceInstance, typeName string, diags tfdiags.Diagnostics)

	// StartDataResourceInstanceRead and EndDataResourceInstanceRead mark the
	// beginning and end of the work to read data for the identified data
	// resource instance.
	//
	// These events occur only when the data resource instance read was delayed
	// due to there not being enough information to read it during the planning
	// phase.
	StartDataResourceInstanceRead func(ctx context.Context, addr addrs.AbsResourceInstance) context.Context
	EndDataResourceInstanceRead   func(ctx context.Context, addr addrs.AbsResourceInstance, resultVal cty.Value, diags tfdiags.Diagnostics)

	// We also embed [shared.Tracer] for some events that are common across
	// plan and apply. [ApplyPlannedChanges] automatically ensures that this
	// nested tracer reaches the shared codepaths that rely on it.
	shared.Tracer
}

Tracer is a container for various callbacks used to report various events that can occur during a call to ApplyPlannedChanges.

Pass a pointer to an object of this type to ContextWithTracer to get an annotated context.Context, and then pass it to ApplyPlannedChanges.

Any fields left as nil will be ignored. Non-nil callbacks will be called whenever the associated event (mentioned in the field's documentation comment) occurs.

Some callback functions come in "Start" and "End" pairs that share a common suffix. In those cases, the Start function is expected to return a context is a child of the one passed to the callback function, possibly annotated with additional information such as OpenTelemetry trace metadata. The returned context is then used for all of the requests that occur between the Start and End calls, and finally the same context is passed to the corresponding End function so that e.g. an OpenTelemetry trace can be closed. Implementations that don't need to preserve additional context can just directly return the provided context without modification.

Jump to

Keyboard shortcuts

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