Documentation ¶
Index ¶
- Variables
- func CheckCoreVersionRequirements(config *configs.Config) tfdiags.Diagnostics
- func GraphDot(g *Graph, opts *dag.DotOpts) (string, error)
- func ReferencesFromConfig(body hcl.Body, schema *configschema.Block) []*addrs.Reference
- type ApplyGraphBuilder
- type AttachDependenciesTransformer
- type AttachResourceConfigTransformer
- type AttachSchemaTransformer
- type AttachStateTransformer
- type BasicGraphBuilder
- type BuiltinEvalContext
- func (ctx *BuiltinEvalContext) Changes() *plans.ChangesSync
- func (ctx *BuiltinEvalContext) Checks() *checks.State
- func (ctx *BuiltinEvalContext) CloseProvider(addr addrs.AbsProviderConfig) error
- func (ctx *BuiltinEvalContext) CloseProvisioners() error
- func (ctx *BuiltinEvalContext) ConfigureProvider(addr addrs.AbsProviderConfig, cfg cty.Value) tfdiags.Diagnostics
- func (ctx *BuiltinEvalContext) EvaluateBlock(body hcl.Body, schema *configschema.Block, self addrs.Referenceable, ...) (cty.Value, hcl.Body, tfdiags.Diagnostics)
- func (ctx *BuiltinEvalContext) EvaluateExpr(expr hcl.Expression, wantType cty.Type, self addrs.Referenceable) (cty.Value, tfdiags.Diagnostics)
- func (ctx *BuiltinEvalContext) EvaluateReplaceTriggeredBy(expr hcl.Expression, repData instances.RepetitionData) (*addrs.Reference, bool, tfdiags.Diagnostics)
- func (ctx *BuiltinEvalContext) EvaluationScope(self addrs.Referenceable, source addrs.Referenceable, ...) *lang.Scope
- func (ctx *BuiltinEvalContext) GetVariableValue(addr addrs.AbsInputVariableInstance) cty.Value
- func (ctx *BuiltinEvalContext) Hook(fn func(Hook) (HookAction, error)) error
- func (ctx *BuiltinEvalContext) InitProvider(addr addrs.AbsProviderConfig) (providers.Interface, error)
- func (ctx *BuiltinEvalContext) Input() UIInput
- func (ctx *BuiltinEvalContext) InstanceExpander() *instances.Expander
- func (ctx *BuiltinEvalContext) MoveResults() refactoring.MoveResults
- func (ctx *BuiltinEvalContext) Path() addrs.ModuleInstance
- func (ctx *BuiltinEvalContext) PrevRunState() *states.SyncState
- func (ctx *BuiltinEvalContext) Provider(addr addrs.AbsProviderConfig) providers.Interface
- func (ctx *BuiltinEvalContext) ProviderInput(pc addrs.AbsProviderConfig) map[string]cty.Value
- func (ctx *BuiltinEvalContext) ProviderSchema(addr addrs.AbsProviderConfig) (providers.ProviderSchema, error)
- func (ctx *BuiltinEvalContext) Provisioner(n string) (provisioners.Interface, error)
- func (ctx *BuiltinEvalContext) ProvisionerSchema(n string) (*configschema.Block, error)
- func (ctx *BuiltinEvalContext) RefreshState() *states.SyncState
- func (ctx *BuiltinEvalContext) SetModuleCallArgument(callAddr addrs.ModuleCallInstance, varAddr addrs.InputVariable, v cty.Value)
- func (ctx *BuiltinEvalContext) SetProviderInput(pc addrs.AbsProviderConfig, c map[string]cty.Value)
- func (ctx *BuiltinEvalContext) SetRootModuleArgument(addr addrs.InputVariable, v cty.Value)
- func (ctx *BuiltinEvalContext) State() *states.SyncState
- func (ctx *BuiltinEvalContext) Stopped() <-chan struct{}
- func (ctx *BuiltinEvalContext) WithPath(path addrs.ModuleInstance) EvalContext
- type CBDEdgeTransformer
- type CallbackUIOutput
- type CloseProviderTransformer
- type CloseRootModuleTransformer
- type ConcreteModuleNodeFunc
- type ConcreteProviderNodeFunc
- type ConcreteResourceInstanceDeposedNodeFunc
- type ConcreteResourceInstanceNodeFunc
- type ConcreteResourceNodeFunc
- type ConfigTransformer
- type Context
- func (c *Context) Apply(plan *plans.Plan, config *configs.Config) (*states.State, tfdiags.Diagnostics)
- func (c *Context) ApplyGraphForUI(plan *plans.Plan, config *configs.Config) (*Graph, tfdiags.Diagnostics)
- func (c *Context) Eval(config *configs.Config, state *states.State, moduleAddr addrs.ModuleInstance, ...) (*lang.Scope, tfdiags.Diagnostics)
- func (c *Context) Import(config *configs.Config, prevRunState *states.State, opts *ImportOpts) (*states.State, tfdiags.Diagnostics)
- func (c *Context) Input(config *configs.Config, mode InputMode) tfdiags.Diagnostics
- func (c *Context) Plan(config *configs.Config, prevRunState *states.State, opts *PlanOpts) (*plans.Plan, tfdiags.Diagnostics)
- func (c *Context) PlanGraphForUI(config *configs.Config, prevRunState *states.State, mode plans.Mode) (*Graph, tfdiags.Diagnostics)
- func (c *Context) Refresh(config *configs.Config, prevRunState *states.State, opts *PlanOpts) (*states.State, tfdiags.Diagnostics)
- func (c *Context) Schemas(config *configs.Config, state *states.State) (*Schemas, tfdiags.Diagnostics)
- func (c *Context) Stop()
- func (c *Context) TestContext(config *configs.Config, state *states.State, plan *plans.Plan, ...) *TestContext
- func (c *Context) Validate(config *configs.Config) tfdiags.Diagnostics
- type ContextGraphOpts
- type ContextGraphWalker
- type ContextMeta
- type ContextOpts
- type DestroyEdgeTransformer
- type DiffTransformer
- type EvalContext
- type EvalGraphBuilder
- type EvalOpts
- type Evaluator
- type ExternalReferenceTransformer
- type ForcedCBDTransformer
- type Graph
- type GraphBuilder
- type GraphNodeAttachDependencies
- type GraphNodeAttachProvider
- type GraphNodeAttachProviderConfigSchema
- type GraphNodeAttachProviderMetaConfigs
- type GraphNodeAttachProvisionerSchema
- type GraphNodeAttachResourceConfig
- type GraphNodeAttachResourceSchema
- type GraphNodeAttachResourceState
- type GraphNodeCloseProvider
- type GraphNodeConfigResource
- type GraphNodeCreator
- type GraphNodeDeposedResourceInstanceObject
- type GraphNodeDeposer
- type GraphNodeDestroyer
- type GraphNodeDestroyerCBD
- type GraphNodeDynamicExpandable
- type GraphNodeExecutable
- type GraphNodeModuleInstance
- type GraphNodeModulePath
- type GraphNodeProvider
- type GraphNodeProviderConsumer
- type GraphNodeProvisionerConsumer
- type GraphNodeReferenceOutside
- type GraphNodeReferenceable
- type GraphNodeReferencer
- type GraphNodeResourceInstance
- type GraphNodeTargetable
- type GraphTransformer
- type GraphVertexTransformer
- type GraphWalker
- type Hook
- type HookAction
- type ImportOpts
- type ImportTarget
- type InputMode
- type InputOpts
- type InputValue
- type InputValues
- type InstanceKeyEvalData
- type LocalTransformer
- type MissingProviderTransformer
- type MockEvalContext
- func (c *MockEvalContext) Changes() *plans.ChangesSync
- func (c *MockEvalContext) Checks() *checks.State
- func (c *MockEvalContext) CloseProvider(addr addrs.AbsProviderConfig) error
- func (c *MockEvalContext) CloseProvisioners() error
- func (c *MockEvalContext) ConfigureProvider(addr addrs.AbsProviderConfig, cfg cty.Value) tfdiags.Diagnostics
- func (c *MockEvalContext) EvaluateBlock(body hcl.Body, schema *configschema.Block, self addrs.Referenceable, ...) (cty.Value, hcl.Body, tfdiags.Diagnostics)
- func (c *MockEvalContext) EvaluateExpr(expr hcl.Expression, wantType cty.Type, self addrs.Referenceable) (cty.Value, tfdiags.Diagnostics)
- func (c *MockEvalContext) EvaluateReplaceTriggeredBy(hcl.Expression, instances.RepetitionData) (*addrs.Reference, bool, tfdiags.Diagnostics)
- func (c *MockEvalContext) EvaluationScope(self addrs.Referenceable, source addrs.Referenceable, ...) *lang.Scope
- func (c *MockEvalContext) GetVariableValue(addr addrs.AbsInputVariableInstance) cty.Value
- func (c *MockEvalContext) Hook(fn func(Hook) (HookAction, error)) error
- func (c *MockEvalContext) InitProvider(addr addrs.AbsProviderConfig) (providers.Interface, error)
- func (c *MockEvalContext) Input() UIInput
- func (c *MockEvalContext) InstanceExpander() *instances.Expander
- func (c *MockEvalContext) MoveResults() refactoring.MoveResults
- func (c *MockEvalContext) Path() addrs.ModuleInstance
- func (c *MockEvalContext) PrevRunState() *states.SyncState
- func (c *MockEvalContext) Provider(addr addrs.AbsProviderConfig) providers.Interface
- func (c *MockEvalContext) ProviderInput(addr addrs.AbsProviderConfig) map[string]cty.Value
- func (c *MockEvalContext) ProviderSchema(addr addrs.AbsProviderConfig) (providers.ProviderSchema, error)
- func (c *MockEvalContext) Provisioner(n string) (provisioners.Interface, error)
- func (c *MockEvalContext) ProvisionerSchema(n string) (*configschema.Block, error)
- func (c *MockEvalContext) RefreshState() *states.SyncState
- func (c *MockEvalContext) SetModuleCallArgument(callAddr addrs.ModuleCallInstance, varAddr addrs.InputVariable, v cty.Value)
- func (c *MockEvalContext) SetProviderInput(addr addrs.AbsProviderConfig, vals map[string]cty.Value)
- func (c *MockEvalContext) SetRootModuleArgument(addr addrs.InputVariable, v cty.Value)
- func (c *MockEvalContext) State() *states.SyncState
- func (c *MockEvalContext) Stopped() <-chan struct{}
- func (c *MockEvalContext) WithPath(path addrs.ModuleInstance) EvalContext
- type MockHook
- func (h *MockHook) PostApply(addr addrs.AbsResourceInstance, gen states.Generation, newState cty.Value, ...) (HookAction, error)
- func (h *MockHook) PostApplyImport(addr addrs.AbsResourceInstance, importing plans.ImportingSrc) (HookAction, error)
- func (h *MockHook) PostDiff(addr addrs.AbsResourceInstance, gen states.Generation, action plans.Action, ...) (HookAction, error)
- func (h *MockHook) PostImportState(addr addrs.AbsResourceInstance, imported []providers.ImportedResource) (HookAction, error)
- func (h *MockHook) PostPlanImport(addr addrs.AbsResourceInstance, imported []providers.ImportedResource) (HookAction, error)
- func (h *MockHook) PostProvisionInstance(addr addrs.AbsResourceInstance, state cty.Value) (HookAction, error)
- func (h *MockHook) PostProvisionInstanceStep(addr addrs.AbsResourceInstance, typeName string, err error) (HookAction, error)
- func (h *MockHook) PostRefresh(addr addrs.AbsResourceInstance, gen states.Generation, priorState cty.Value, ...) (HookAction, error)
- func (h *MockHook) PostStateUpdate(new *states.State) (HookAction, error)
- func (h *MockHook) PreApply(addr addrs.AbsResourceInstance, gen states.Generation, action plans.Action, ...) (HookAction, error)
- func (h *MockHook) PreApplyImport(addr addrs.AbsResourceInstance, importing plans.ImportingSrc) (HookAction, error)
- func (h *MockHook) PreDiff(addr addrs.AbsResourceInstance, gen states.Generation, ...) (HookAction, error)
- func (h *MockHook) PreImportState(addr addrs.AbsResourceInstance, importID string) (HookAction, error)
- func (h *MockHook) PrePlanImport(addr addrs.AbsResourceInstance, importID string) (HookAction, error)
- func (h *MockHook) PreProvisionInstance(addr addrs.AbsResourceInstance, state cty.Value) (HookAction, error)
- func (h *MockHook) PreProvisionInstanceStep(addr addrs.AbsResourceInstance, typeName string) (HookAction, error)
- func (h *MockHook) PreRefresh(addr addrs.AbsResourceInstance, gen states.Generation, priorState cty.Value) (HookAction, error)
- func (h *MockHook) ProvisionOutput(addr addrs.AbsResourceInstance, typeName string, line string)
- func (h *MockHook) Stopping()
- type MockProvider
- func (p *MockProvider) ApplyResourceChange(r providers.ApplyResourceChangeRequest) (resp providers.ApplyResourceChangeResponse)
- func (p *MockProvider) Close() error
- func (p *MockProvider) ConfigureProvider(r providers.ConfigureProviderRequest) (resp providers.ConfigureProviderResponse)
- func (p *MockProvider) GetProviderSchema() providers.GetProviderSchemaResponse
- func (p *MockProvider) ImportResourceState(r providers.ImportResourceStateRequest) (resp providers.ImportResourceStateResponse)
- func (p *MockProvider) PlanResourceChange(r providers.PlanResourceChangeRequest) (resp providers.PlanResourceChangeResponse)
- func (p *MockProvider) ReadDataSource(r providers.ReadDataSourceRequest) (resp providers.ReadDataSourceResponse)
- func (p *MockProvider) ReadResource(r providers.ReadResourceRequest) (resp providers.ReadResourceResponse)
- func (p *MockProvider) Stop() error
- func (p *MockProvider) UpgradeResourceState(r providers.UpgradeResourceStateRequest) (resp providers.UpgradeResourceStateResponse)
- func (p *MockProvider) ValidateDataResourceConfig(r providers.ValidateDataResourceConfigRequest) (resp providers.ValidateDataResourceConfigResponse)
- func (p *MockProvider) ValidateProviderConfig(r providers.ValidateProviderConfigRequest) (resp providers.ValidateProviderConfigResponse)
- func (p *MockProvider) ValidateResourceConfig(r providers.ValidateResourceConfigRequest) (resp providers.ValidateResourceConfigResponse)
- type MockProvisioner
- func (p *MockProvisioner) Close() error
- func (p *MockProvisioner) GetSchema() provisioners.GetSchemaResponse
- func (p *MockProvisioner) ProvisionResource(r provisioners.ProvisionResourceRequest) provisioners.ProvisionResourceResponse
- func (p *MockProvisioner) Stop() error
- func (p *MockProvisioner) ValidateProvisionerConfig(r provisioners.ValidateProvisionerConfigRequest) provisioners.ValidateProvisionerConfigResponse
- type MockUIInput
- type MockUIOutput
- type ModuleExpansionTransformer
- type ModuleVariableTransformer
- type NilHook
- func (*NilHook) PostApply(addr addrs.AbsResourceInstance, gen states.Generation, newState cty.Value, ...) (HookAction, error)
- func (h *NilHook) PostApplyImport(addr addrs.AbsResourceInstance, importing plans.ImportingSrc) (HookAction, error)
- func (*NilHook) PostDiff(addr addrs.AbsResourceInstance, gen states.Generation, action plans.Action, ...) (HookAction, error)
- func (*NilHook) PostImportState(addr addrs.AbsResourceInstance, imported []providers.ImportedResource) (HookAction, error)
- func (h *NilHook) PostPlanImport(addr addrs.AbsResourceInstance, imported []providers.ImportedResource) (HookAction, error)
- func (*NilHook) PostProvisionInstance(addr addrs.AbsResourceInstance, state cty.Value) (HookAction, error)
- func (*NilHook) PostProvisionInstanceStep(addr addrs.AbsResourceInstance, typeName string, err error) (HookAction, error)
- func (*NilHook) PostRefresh(addr addrs.AbsResourceInstance, gen states.Generation, priorState cty.Value, ...) (HookAction, error)
- func (*NilHook) PostStateUpdate(new *states.State) (HookAction, error)
- func (*NilHook) PreApply(addr addrs.AbsResourceInstance, gen states.Generation, action plans.Action, ...) (HookAction, error)
- func (h *NilHook) PreApplyImport(addr addrs.AbsResourceInstance, importing plans.ImportingSrc) (HookAction, error)
- func (*NilHook) PreDiff(addr addrs.AbsResourceInstance, gen states.Generation, ...) (HookAction, error)
- func (*NilHook) PreImportState(addr addrs.AbsResourceInstance, importID string) (HookAction, error)
- func (h *NilHook) PrePlanImport(addr addrs.AbsResourceInstance, importID string) (HookAction, error)
- func (*NilHook) PreProvisionInstance(addr addrs.AbsResourceInstance, state cty.Value) (HookAction, error)
- func (*NilHook) PreProvisionInstanceStep(addr addrs.AbsResourceInstance, typeName string) (HookAction, error)
- func (*NilHook) PreRefresh(addr addrs.AbsResourceInstance, gen states.Generation, priorState cty.Value) (HookAction, error)
- func (*NilHook) ProvisionOutput(addr addrs.AbsResourceInstance, typeName string, line string)
- func (*NilHook) Stopping()
- type NodeAbstractProvider
- func (n *NodeAbstractProvider) AttachProvider(c *configs.Provider)
- func (n *NodeAbstractProvider) AttachProviderConfigSchema(schema *configschema.Block)
- func (n *NodeAbstractProvider) DotNode(name string, opts *dag.DotOpts) *dag.DotNode
- func (n *NodeAbstractProvider) ModulePath() addrs.Module
- func (n *NodeAbstractProvider) Name() string
- func (n *NodeAbstractProvider) Path() addrs.ModuleInstance
- func (n *NodeAbstractProvider) ProviderAddr() addrs.AbsProviderConfig
- func (n *NodeAbstractProvider) ProviderConfig() *configs.Provider
- func (n *NodeAbstractProvider) References() []*addrs.Reference
- type NodeAbstractResource
- func (n *NodeAbstractResource) AttachDataResourceDependsOn(deps []addrs.ConfigResource, force bool)
- func (n *NodeAbstractResource) AttachProviderMetaConfigs(c map[addrs.Provider]*configs.ProviderMeta)
- func (n *NodeAbstractResource) AttachProvisionerSchema(name string, schema *configschema.Block)
- func (n *NodeAbstractResource) AttachResourceConfig(c *configs.Resource)
- func (n *NodeAbstractResource) AttachResourceSchema(schema *configschema.Block, version uint64)
- func (n *NodeAbstractResource) DependsOn() []*addrs.Reference
- func (n *NodeAbstractResource) DotNode(name string, opts *dag.DotOpts) *dag.DotNode
- func (n *NodeAbstractResource) ModulePath() addrs.Module
- func (n *NodeAbstractResource) Name() string
- func (n *NodeAbstractResource) ProvidedBy() (addrs.ProviderConfig, bool)
- func (n *NodeAbstractResource) Provider() addrs.Provider
- func (n *NodeAbstractResource) ProvisionedBy() []string
- func (n *NodeAbstractResource) ReferenceableAddrs() []addrs.Referenceable
- func (n *NodeAbstractResource) References() []*addrs.Reference
- func (n *NodeAbstractResource) ResourceAddr() addrs.ConfigResource
- func (n *NodeAbstractResource) SetProvider(p addrs.AbsProviderConfig)
- func (n *NodeAbstractResource) SetTargets(targets []addrs.Targetable)
- type NodeAbstractResourceInstance
- func (n *NodeAbstractResourceInstance) AttachResourceState(s *states.Resource)
- func (n *NodeAbstractResourceInstance) Name() string
- func (n *NodeAbstractResourceInstance) Path() addrs.ModuleInstance
- func (n *NodeAbstractResourceInstance) ReferenceableAddrs() []addrs.Referenceable
- func (n *NodeAbstractResourceInstance) References() []*addrs.Reference
- func (n *NodeAbstractResourceInstance) ResourceInstanceAddr() addrs.AbsResourceInstance
- func (n *NodeAbstractResourceInstance) StateDependencies() []addrs.ConfigResource
- type NodeApplyableOutput
- func (n *NodeApplyableOutput) DotNode(name string, opts *dag.DotOpts) *dag.DotNode
- func (n *NodeApplyableOutput) Execute(ctx EvalContext, op walkOperation) (diags tfdiags.Diagnostics)
- func (n *NodeApplyableOutput) ModulePath() addrs.Module
- func (n *NodeApplyableOutput) Name() string
- func (n *NodeApplyableOutput) Path() addrs.ModuleInstance
- func (n *NodeApplyableOutput) ReferenceOutside() (selfPath, referencePath addrs.Module)
- func (n *NodeApplyableOutput) ReferenceableAddrs() []addrs.Referenceable
- func (n *NodeApplyableOutput) References() []*addrs.Reference
- type NodeApplyableProvider
- func (n *NodeApplyableProvider) ConfigureProvider(ctx EvalContext, provider providers.Interface, verifyConfigIsKnown bool) (diags tfdiags.Diagnostics)
- func (n *NodeApplyableProvider) Execute(ctx EvalContext, op walkOperation) (diags tfdiags.Diagnostics)
- func (n *NodeApplyableProvider) ValidateProvider(ctx EvalContext, provider providers.Interface) (diags tfdiags.Diagnostics)
- type NodeApplyableResourceInstance
- func (n *NodeApplyableResourceInstance) AttachDependencies(deps []addrs.ConfigResource)
- func (n *NodeApplyableResourceInstance) CreateAddr() *addrs.AbsResourceInstance
- func (n *NodeApplyableResourceInstance) CreateBeforeDestroy() bool
- func (n *NodeApplyableResourceInstance) Execute(ctx EvalContext, op walkOperation) (diags tfdiags.Diagnostics)
- func (n *NodeApplyableResourceInstance) ModifyCreateBeforeDestroy(v bool) error
- func (n *NodeApplyableResourceInstance) References() []*addrs.Reference
- func (n *NodeApplyableResourceInstance) SetPreallocatedDeposedKey(key states.DeposedKey)
- type NodeDestroyDeposedResourceInstanceObject
- func (n *NodeDestroyDeposedResourceInstanceObject) CreateBeforeDestroy() bool
- func (n *NodeDestroyDeposedResourceInstanceObject) DeposedInstanceObjectKey() states.DeposedKey
- func (n *NodeDestroyDeposedResourceInstanceObject) DestroyAddr() *addrs.AbsResourceInstance
- func (n *NodeDestroyDeposedResourceInstanceObject) Execute(ctx EvalContext, op walkOperation) (diags tfdiags.Diagnostics)
- func (n *NodeDestroyDeposedResourceInstanceObject) ModifyCreateBeforeDestroy(v bool) error
- func (n *NodeDestroyDeposedResourceInstanceObject) Name() string
- func (n *NodeDestroyDeposedResourceInstanceObject) ReferenceableAddrs() []addrs.Referenceable
- func (n *NodeDestroyDeposedResourceInstanceObject) References() []*addrs.Reference
- type NodeDestroyResourceInstance
- func (n *NodeDestroyResourceInstance) CreateBeforeDestroy() bool
- func (n *NodeDestroyResourceInstance) DestroyAddr() *addrs.AbsResourceInstance
- func (n *NodeDestroyResourceInstance) Execute(ctx EvalContext, op walkOperation) (diags tfdiags.Diagnostics)
- func (n *NodeDestroyResourceInstance) ModifyCreateBeforeDestroy(v bool) error
- func (n *NodeDestroyResourceInstance) Name() string
- func (n *NodeDestroyResourceInstance) ProvidedBy() (addr addrs.ProviderConfig, exact bool)
- func (n *NodeDestroyResourceInstance) ReferenceableAddrs() []addrs.Referenceable
- func (n *NodeDestroyResourceInstance) References() []*addrs.Reference
- type NodeDestroyableDataResourceInstance
- type NodeDestroyableOutput
- type NodeEvalableProvider
- type NodeLocal
- func (n *NodeLocal) DotNode(name string, opts *dag.DotOpts) *dag.DotNode
- func (n *NodeLocal) Execute(ctx EvalContext, op walkOperation) (diags tfdiags.Diagnostics)
- func (n *NodeLocal) ModulePath() addrs.Module
- func (n *NodeLocal) Name() string
- func (n *NodeLocal) Path() addrs.ModuleInstance
- func (n *NodeLocal) ReferenceableAddrs() []addrs.Referenceable
- func (n *NodeLocal) References() []*addrs.Reference
- type NodePlanDeposedResourceInstanceObject
- func (n *NodePlanDeposedResourceInstanceObject) DeposedInstanceObjectKey() states.DeposedKey
- func (n *NodePlanDeposedResourceInstanceObject) Execute(ctx EvalContext, op walkOperation) (diags tfdiags.Diagnostics)
- func (n *NodePlanDeposedResourceInstanceObject) Name() string
- func (n *NodePlanDeposedResourceInstanceObject) ReferenceableAddrs() []addrs.Referenceable
- func (n *NodePlanDeposedResourceInstanceObject) References() []*addrs.Reference
- type NodePlanDestroyableResourceInstance
- type NodePlannableResourceInstance
- type NodePlannableResourceInstanceOrphan
- type NodeRootVariable
- func (n *NodeRootVariable) DotNode(name string, opts *dag.DotOpts) *dag.DotNode
- func (n *NodeRootVariable) Execute(ctx EvalContext, op walkOperation) tfdiags.Diagnostics
- func (n *NodeRootVariable) ModulePath() addrs.Module
- func (n *NodeRootVariable) Name() string
- func (n *NodeRootVariable) Path() addrs.ModuleInstance
- func (n *NodeRootVariable) ReferenceableAddrs() []addrs.Referenceable
- type NodeValidatableResource
- type NullGraphWalker
- type OrphanOutputTransformer
- type OrphanResourceInstanceCountTransformer
- type OrphanResourceInstanceTransformer
- type OutputTransformer
- type PlanGraphBuilder
- type PlanOpts
- type PrefixUIInput
- type ProviderConfigTransformer
- type ProviderTransformer
- type ProvisionerUIOutput
- type PruneProviderTransformer
- type ReferenceMap
- type ReferenceTransformer
- type RemovedModuleTransformer
- type ResourceCountTransformer
- type RootTransformer
- type RootVariableTransformer
- type Schemas
- func (ss *Schemas) ProviderConfig(provider addrs.Provider) *configschema.Block
- func (ss *Schemas) ProviderSchema(provider addrs.Provider) providers.ProviderSchema
- func (ss *Schemas) ProvisionerConfig(name string) *configschema.Block
- func (ss *Schemas) ResourceTypeConfig(provider addrs.Provider, resourceMode addrs.ResourceMode, resourceType string) (block *configschema.Block, schemaVersion uint64)
- type Semaphore
- type StateTransformer
- type TargetsTransformer
- type TestContext
- type TransitiveReductionTransformer
- type UIInput
- type UIOutput
- type ValueSourceType
- type VertexTransformer
- Bugs
Constants ¶
This section is empty.
Variables ¶
var DefaultPlanOpts = &PlanOpts{ Mode: plans.NormalMode, }
var EvalDataForNoInstanceKey = InstanceKeyEvalData{}
EvalDataForNoInstanceKey is a value of InstanceKeyData that sets no instance key values at all, suitable for use in contexts where no keyed instance is relevant.
Functions ¶
func CheckCoreVersionRequirements ¶
func CheckCoreVersionRequirements(config *configs.Config) tfdiags.Diagnostics
CheckCoreVersionRequirements visits each of the modules in the given configuration tree and verifies that any given Core version constraints match with the version of OpenTofu Core that is being used.
The returned diagnostics will contain errors if any constraints do not match. The returned diagnostics might also return warnings, which should be displayed to the user.
func GraphDot ¶
GraphDot returns the dot formatting of a visual representation of the given OpenTofu graph.
func ReferencesFromConfig ¶
func ReferencesFromConfig(body hcl.Body, schema *configschema.Block) []*addrs.Reference
ReferencesFromConfig returns the references that a configuration has based on the interpolated variables in a configuration.
Types ¶
type ApplyGraphBuilder ¶
type ApplyGraphBuilder struct { // Config is the configuration tree that the diff was built from. Config *configs.Config // Changes describes the changes that we need apply. Changes *plans.Changes // State is the current state State *states.State // RootVariableValues are the root module input variables captured as // part of the plan object, which we must reproduce in the apply step // to get a consistent result. RootVariableValues InputValues // Plugins is a library of the plug-in components (providers and // provisioners) available for use. Plugins *contextPlugins // Targets are resources to target. This is only required to make sure // unnecessary outputs aren't included in the apply graph. The plan // builder successfully handles targeting resources. In the future, // outputs should go into the diff so that this is unnecessary. Targets []addrs.Targetable // ForceReplace are the resource instance addresses that the user // requested to force replacement for when creating the plan, if any. // The apply step refers to these as part of verifying that the planned // actions remain consistent between plan and apply. ForceReplace []addrs.AbsResourceInstance // Plan Operation this graph will be used for. Operation walkOperation // ExternalReferences allows the external caller to pass in references to // nodes that should not be pruned even if they are not referenced within // the actual graph. ExternalReferences []*addrs.Reference }
ApplyGraphBuilder implements GraphBuilder and is responsible for building a graph for applying a OpenTofu diff.
Because the graph is built from the diff (vs. the config or state), this helps ensure that the apply-time graph doesn't modify any resources that aren't explicitly in the diff. There are other scenarios where the diff can be deviated, so this is just one layer of protection.
func (*ApplyGraphBuilder) Build ¶
func (b *ApplyGraphBuilder) Build(path addrs.ModuleInstance) (*Graph, tfdiags.Diagnostics)
See GraphBuilder
func (*ApplyGraphBuilder) Steps ¶
func (b *ApplyGraphBuilder) Steps() []GraphTransformer
See GraphBuilder
type AttachDependenciesTransformer ¶
type AttachDependenciesTransformer struct { }
AttachDependenciesTransformer records all resource dependencies for each instance, and attaches the addresses to the node itself. Managed resource will record these in the state for proper ordering of destroy operations.
func (AttachDependenciesTransformer) Transform ¶
func (t AttachDependenciesTransformer) Transform(g *Graph) error
type AttachResourceConfigTransformer ¶
type AttachResourceConfigTransformer struct {
Config *configs.Config // Config is the root node in the config tree
}
AttachResourceConfigTransformer goes through the graph and attaches resource configuration structures to nodes that implement GraphNodeAttachManagedResourceConfig or GraphNodeAttachDataResourceConfig.
The attached configuration structures are directly from the configuration. If they're going to be modified, a copy should be made.
func (*AttachResourceConfigTransformer) Transform ¶
func (t *AttachResourceConfigTransformer) Transform(g *Graph) error
type AttachSchemaTransformer ¶
AttachSchemaTransformer finds nodes that implement GraphNodeAttachResourceSchema, GraphNodeAttachProviderConfigSchema, or GraphNodeAttachProvisionerSchema, looks up the needed schemas for each and then passes them to a method implemented by the node.
func (*AttachSchemaTransformer) Transform ¶
func (t *AttachSchemaTransformer) Transform(g *Graph) error
type AttachStateTransformer ¶
AttachStateTransformer goes through the graph and attaches state to nodes that implement the interfaces above.
func (*AttachStateTransformer) Transform ¶
func (t *AttachStateTransformer) Transform(g *Graph) error
type BasicGraphBuilder ¶
type BasicGraphBuilder struct { Steps []GraphTransformer // Optional name to add to the graph debug log Name string }
BasicGraphBuilder is a GraphBuilder that builds a graph out of a series of transforms and (optionally) validates the graph is a valid structure.
func (*BasicGraphBuilder) Build ¶
func (b *BasicGraphBuilder) Build(path addrs.ModuleInstance) (*Graph, tfdiags.Diagnostics)
type BuiltinEvalContext ¶
type BuiltinEvalContext struct { // StopContext is the context used to track whether we're complete StopContext context.Context // PathValue is the Path that this context is operating within. PathValue addrs.ModuleInstance // Evaluator is used for evaluating expressions within the scope of this // eval context. Evaluator *Evaluator // VariableValues contains the variable values across all modules. This // structure is shared across the entire containing context, and so it // may be accessed only when holding VariableValuesLock. // The keys of the first level of VariableValues are the string // representations of addrs.ModuleInstance values. The second-level keys // are variable names within each module instance. VariableValues map[string]map[string]cty.Value VariableValuesLock *sync.Mutex // Plugins is a library of plugin components (providers and provisioners) // available for use during a graph walk. Plugins *contextPlugins Hooks []Hook InputValue UIInput ProviderCache map[string]providers.Interface ProviderInputConfig map[string]map[string]cty.Value ProviderLock *sync.Mutex ProvisionerCache map[string]provisioners.Interface ProvisionerLock *sync.Mutex ChangesValue *plans.ChangesSync StateValue *states.SyncState ChecksValue *checks.State RefreshStateValue *states.SyncState PrevRunStateValue *states.SyncState InstanceExpanderValue *instances.Expander MoveResultsValue refactoring.MoveResults // contains filtered or unexported fields }
BuiltinEvalContext is an EvalContext implementation that is used by OpenTofu by default.
func (*BuiltinEvalContext) Changes ¶
func (ctx *BuiltinEvalContext) Changes() *plans.ChangesSync
func (*BuiltinEvalContext) Checks ¶
func (ctx *BuiltinEvalContext) Checks() *checks.State
func (*BuiltinEvalContext) CloseProvider ¶
func (ctx *BuiltinEvalContext) CloseProvider(addr addrs.AbsProviderConfig) error
func (*BuiltinEvalContext) CloseProvisioners ¶
func (ctx *BuiltinEvalContext) CloseProvisioners() error
func (*BuiltinEvalContext) ConfigureProvider ¶
func (ctx *BuiltinEvalContext) ConfigureProvider(addr addrs.AbsProviderConfig, cfg cty.Value) tfdiags.Diagnostics
func (*BuiltinEvalContext) EvaluateBlock ¶
func (ctx *BuiltinEvalContext) EvaluateBlock(body hcl.Body, schema *configschema.Block, self addrs.Referenceable, keyData InstanceKeyEvalData) (cty.Value, hcl.Body, tfdiags.Diagnostics)
func (*BuiltinEvalContext) EvaluateExpr ¶
func (ctx *BuiltinEvalContext) EvaluateExpr(expr hcl.Expression, wantType cty.Type, self addrs.Referenceable) (cty.Value, tfdiags.Diagnostics)
func (*BuiltinEvalContext) EvaluateReplaceTriggeredBy ¶
func (ctx *BuiltinEvalContext) EvaluateReplaceTriggeredBy(expr hcl.Expression, repData instances.RepetitionData) (*addrs.Reference, bool, tfdiags.Diagnostics)
func (*BuiltinEvalContext) EvaluationScope ¶
func (ctx *BuiltinEvalContext) EvaluationScope(self addrs.Referenceable, source addrs.Referenceable, keyData InstanceKeyEvalData) *lang.Scope
func (*BuiltinEvalContext) GetVariableValue ¶
func (ctx *BuiltinEvalContext) GetVariableValue(addr addrs.AbsInputVariableInstance) cty.Value
func (*BuiltinEvalContext) Hook ¶
func (ctx *BuiltinEvalContext) Hook(fn func(Hook) (HookAction, error)) error
func (*BuiltinEvalContext) InitProvider ¶
func (ctx *BuiltinEvalContext) InitProvider(addr addrs.AbsProviderConfig) (providers.Interface, error)
func (*BuiltinEvalContext) Input ¶
func (ctx *BuiltinEvalContext) Input() UIInput
func (*BuiltinEvalContext) InstanceExpander ¶
func (ctx *BuiltinEvalContext) InstanceExpander() *instances.Expander
func (*BuiltinEvalContext) MoveResults ¶
func (ctx *BuiltinEvalContext) MoveResults() refactoring.MoveResults
func (*BuiltinEvalContext) Path ¶
func (ctx *BuiltinEvalContext) Path() addrs.ModuleInstance
func (*BuiltinEvalContext) PrevRunState ¶
func (ctx *BuiltinEvalContext) PrevRunState() *states.SyncState
func (*BuiltinEvalContext) Provider ¶
func (ctx *BuiltinEvalContext) Provider(addr addrs.AbsProviderConfig) providers.Interface
func (*BuiltinEvalContext) ProviderInput ¶
func (ctx *BuiltinEvalContext) ProviderInput(pc addrs.AbsProviderConfig) map[string]cty.Value
func (*BuiltinEvalContext) ProviderSchema ¶
func (ctx *BuiltinEvalContext) ProviderSchema(addr addrs.AbsProviderConfig) (providers.ProviderSchema, error)
func (*BuiltinEvalContext) Provisioner ¶
func (ctx *BuiltinEvalContext) Provisioner(n string) (provisioners.Interface, error)
func (*BuiltinEvalContext) ProvisionerSchema ¶
func (ctx *BuiltinEvalContext) ProvisionerSchema(n string) (*configschema.Block, error)
func (*BuiltinEvalContext) RefreshState ¶
func (ctx *BuiltinEvalContext) RefreshState() *states.SyncState
func (*BuiltinEvalContext) SetModuleCallArgument ¶
func (ctx *BuiltinEvalContext) SetModuleCallArgument(callAddr addrs.ModuleCallInstance, varAddr addrs.InputVariable, v cty.Value)
func (*BuiltinEvalContext) SetProviderInput ¶
func (ctx *BuiltinEvalContext) SetProviderInput(pc addrs.AbsProviderConfig, c map[string]cty.Value)
func (*BuiltinEvalContext) SetRootModuleArgument ¶
func (ctx *BuiltinEvalContext) SetRootModuleArgument(addr addrs.InputVariable, v cty.Value)
func (*BuiltinEvalContext) State ¶
func (ctx *BuiltinEvalContext) State() *states.SyncState
func (*BuiltinEvalContext) Stopped ¶
func (ctx *BuiltinEvalContext) Stopped() <-chan struct{}
func (*BuiltinEvalContext) WithPath ¶
func (ctx *BuiltinEvalContext) WithPath(path addrs.ModuleInstance) EvalContext
type CBDEdgeTransformer ¶
type CBDEdgeTransformer struct { // Module and State are only needed to look up dependencies in // any way possible. Either can be nil if not availabile. Config *configs.Config State *states.State }
CBDEdgeTransformer modifies the edges of create-before-destroy ("CBD") nodes that went through the DestroyEdgeTransformer so that they will have the correct dependencies. There are two parts to this:
With CBD, the destroy edge is inverted: the destroy depends on the creation.
Destroy for A must depend on resources that depend on A. This is to allow the destroy to only happen once nodes that depend on A successfully update to A. Example: adding a web server updates the load balancer before deleting the old web server.
This transformer requires that a previous transformer has already forced create_before_destroy on for nodes that are depended on by explicit CBD nodes. This is the logic in ForcedCBDTransformer, though in practice we will get here by recording the CBD-ness of each change in the plan during the plan walk and then forcing the nodes into the appropriate setting during DiffTransformer when building the apply graph.
func (*CBDEdgeTransformer) Transform ¶
func (t *CBDEdgeTransformer) Transform(g *Graph) error
type CallbackUIOutput ¶
type CallbackUIOutput struct {
OutputFn func(string)
}
func (*CallbackUIOutput) Output ¶
func (o *CallbackUIOutput) Output(v string)
type CloseProviderTransformer ¶
type CloseProviderTransformer struct{}
CloseProviderTransformer is a GraphTransformer that adds nodes to the graph that will close open provider connections that aren't needed anymore. A provider connection is not needed anymore once all depended resources in the graph are evaluated.
func (*CloseProviderTransformer) Transform ¶
func (t *CloseProviderTransformer) Transform(g *Graph) error
type CloseRootModuleTransformer ¶
type CloseRootModuleTransformer struct{}
CloseRootModuleTransformer is a GraphTransformer that adds a root to the graph.
func (*CloseRootModuleTransformer) Transform ¶
func (t *CloseRootModuleTransformer) Transform(g *Graph) error
type ConcreteModuleNodeFunc ¶
type ConcreteProviderNodeFunc ¶
type ConcreteProviderNodeFunc func(*NodeAbstractProvider) dag.Vertex
ConcreteProviderNodeFunc is a callback type used to convert an abstract provider to a concrete one of some type.
type ConcreteResourceInstanceDeposedNodeFunc ¶
type ConcreteResourceInstanceDeposedNodeFunc func(*NodeAbstractResourceInstance, states.DeposedKey) dag.Vertex
ConcreteResourceInstanceDeposedNodeFunc is a callback type used to convert an abstract resource instance to a concrete one of some type that has an associated deposed object key.
type ConcreteResourceInstanceNodeFunc ¶
type ConcreteResourceInstanceNodeFunc func(*NodeAbstractResourceInstance) dag.Vertex
ConcreteResourceInstanceNodeFunc is a callback type used to convert an abstract resource instance to a concrete one of some type.
type ConcreteResourceNodeFunc ¶
type ConcreteResourceNodeFunc func(*NodeAbstractResource) dag.Vertex
ConcreteResourceNodeFunc is a callback type used to convert an abstract resource to a concrete one of some type.
type ConfigTransformer ¶
type ConfigTransformer struct { Concrete ConcreteResourceNodeFunc // Module is the module to add resources from. Config *configs.Config // Mode will only add resources that match the given mode ModeFilter bool Mode addrs.ResourceMode // contains filtered or unexported fields }
ConfigTransformer is a GraphTransformer that adds all the resources from the configuration to the graph.
The module used to configure this transformer must be the root module.
Only resources are added to the graph. Variables, outputs, and providers must be added via other transforms.
Unlike ConfigTransformerOld, this transformer creates a graph with all resources including module resources, rather than creating module nodes that are then "flattened".
func (*ConfigTransformer) Transform ¶
func (t *ConfigTransformer) Transform(g *Graph) error
type Context ¶
type Context struct {
// contains filtered or unexported fields
}
Context represents all the context that OpenTofu needs in order to perform operations on infrastructure. This structure is built using NewContext.
func NewContext ¶
func NewContext(opts *ContextOpts) (*Context, tfdiags.Diagnostics)
NewContext creates a new Context structure.
Once a Context is created, the caller must not access or mutate any of the objects referenced (directly or indirectly) by the ContextOpts fields.
If the returned diagnostics contains errors then the resulting context is invalid and must not be used.
func (*Context) Apply ¶
func (c *Context) Apply(plan *plans.Plan, config *configs.Config) (*states.State, tfdiags.Diagnostics)
Apply performs the actions described by the given Plan object and returns the resulting updated state.
The given configuration *must* be the same configuration that was passed earlier to Context.Plan in order to create this plan.
Even if the returned diagnostics contains errors, Apply always returns the resulting state which is likely to have been partially-updated.
func (*Context) ApplyGraphForUI ¶
func (c *Context) ApplyGraphForUI(plan *plans.Plan, config *configs.Config) (*Graph, tfdiags.Diagnostics)
ApplyGraphForUI is a last vestage of graphs in the public interface of Context (as opposed to graphs as an implementation detail) intended only for use by the "tofu graph" command when asked to render an apply-time graph.
The result of this is intended only for rendering ot the user as a dot graph, and so may change in future in order to make the result more useful in that context, even if drifts away from the physical graph that OpenTofu Core currently uses as an implementation detail of planning.
func (*Context) Eval ¶
func (c *Context) Eval(config *configs.Config, state *states.State, moduleAddr addrs.ModuleInstance, opts *EvalOpts) (*lang.Scope, tfdiags.Diagnostics)
Eval produces a scope in which expressions can be evaluated for the given module path.
This method must first evaluate any ephemeral values (input variables, local values, and output values) in the configuration. These ephemeral values are not included in the persisted state, so they must be re-computed using other values in the state before they can be properly evaluated. The updated values are retained in the main state associated with the receiving context.
This function takes no action against remote APIs but it does need access to all provider and provisioner instances in order to obtain their schemas for type checking.
The result is an evaluation scope that can be used to resolve references against the root module. If the returned diagnostics contains errors then the returned scope may be nil. If it is not nil then it may still be used to attempt expression evaluation or other analysis, but some expressions may not behave as expected.
func (*Context) Import ¶
func (c *Context) Import(config *configs.Config, prevRunState *states.State, opts *ImportOpts) (*states.State, tfdiags.Diagnostics)
Import takes already-created external resources and brings them under OpenTofu management. Import requires the exact type, name, and ID of the resources to import.
This operation is idempotent. If the requested resource is already imported, no changes are made to the state.
Further, this operation also gracefully handles partial state. If during an import there is a failure, all previously imported resources remain imported.
func (*Context) Input ¶
Input asks for input to fill unset required arguments in provider configurations.
Unlike the other better-behaved operation methods, this one actually modifies some internal state inside the receving context so that the captured values will be implicitly available to a subsequent call to Plan, or to some other operation entry point. Hopefully a future iteration of this will change design to make that data flow more explicit.
Because Input saves the results inside the Context object, asking for input twice on the same Context is invalid and will lead to undefined behavior.
Once you've called Input with a particular config, it's invalid to call any other Context method with a different config, because the aforementioned modified internal state won't match. Again, this is an architectural wart that we'll hopefully resolve in future.
func (*Context) Plan ¶
func (c *Context) Plan(config *configs.Config, prevRunState *states.State, opts *PlanOpts) (*plans.Plan, tfdiags.Diagnostics)
Plan generates an execution plan by comparing the given configuration with the given previous run state.
The given planning options allow control of various other details of the planning process that are not represented directly in the configuration. You can use tofu.DefaultPlanOpts to generate a normal plan with no special options.
If the returned diagnostics contains no errors then the returned plan is applyable, although OpenTofu cannot guarantee that applying it will fully succeed. If the returned diagnostics contains errors but this method still returns a non-nil Plan then the plan describes the subset of actions planned so far, which is not safe to apply but could potentially be used by the UI layer to give extra context to support understanding of the returned error messages.
func (*Context) PlanGraphForUI ¶
func (c *Context) PlanGraphForUI(config *configs.Config, prevRunState *states.State, mode plans.Mode) (*Graph, tfdiags.Diagnostics)
PlanGraphForUI is a last vestage of graphs in the public interface of Context (as opposed to graphs as an implementation detail) intended only for use by the "tofu graph" command when asked to render a plan-time graph.
The result of this is intended only for rendering to the user as a dot graph, and so may change in future in order to make the result more useful in that context, even if drifts away from the physical graph that OpenTofu Core currently uses as an implementation detail of planning.
func (*Context) Refresh ¶
func (c *Context) Refresh(config *configs.Config, prevRunState *states.State, opts *PlanOpts) (*states.State, tfdiags.Diagnostics)
Refresh is a vestigial operation that is equivalent to call to Plan and then taking the prior state of the resulting plan.
We retain this only as a measure of semi-backward-compatibility for automation relying on the "tofu refresh" subcommand. The modern way to get this effect is to create and then apply a plan in the refresh-only mode.
func (*Context) Stop ¶
func (c *Context) Stop()
Stop stops the running task.
Stop will block until the task completes.
func (*Context) TestContext ¶
func (c *Context) TestContext(config *configs.Config, state *states.State, plan *plans.Plan, variables InputValues) *TestContext
TestContext creates a TestContext structure that can evaluate test assertions against the provided state and plan.
func (*Context) Validate ¶
func (c *Context) Validate(config *configs.Config) tfdiags.Diagnostics
Validate performs semantic validation of a configuration, and returns any warnings or errors.
Syntax and structural checks are performed by the configuration loader, and so are not repeated here.
Validate considers only the configuration and so it won't catch any errors caused by current values in the state, or other external information such as root module input variables. However, the Plan function includes all of the same checks as Validate, in addition to the other work it does to consider the previous run state and the planning options.
type ContextGraphOpts ¶
type ContextGraphWalker ¶
type ContextGraphWalker struct { NullGraphWalker // Configurable values Context *Context State *states.SyncState // Used for safe concurrent access to state RefreshState *states.SyncState // Used for safe concurrent access to state PrevRunState *states.SyncState // Used for safe concurrent access to state Changes *plans.ChangesSync // Used for safe concurrent writes to changes Checks *checks.State // Used for safe concurrent writes of checkable objects and their check results InstanceExpander *instances.Expander // Tracks our gradual expansion of module and resource instances Imports []configs.Import MoveResults refactoring.MoveResults // Read-only record of earlier processing of move statements Operation walkOperation StopContext context.Context RootVariableValues InputValues Config *configs.Config PlanTimestamp time.Time // This is an output. Do not set this, nor read it while a graph walk // is in progress. NonFatalDiagnostics tfdiags.Diagnostics // contains filtered or unexported fields }
ContextGraphWalker is the GraphWalker implementation used with the Context struct to walk and evaluate the graph.
func (*ContextGraphWalker) EnterPath ¶
func (w *ContextGraphWalker) EnterPath(path addrs.ModuleInstance) EvalContext
func (*ContextGraphWalker) EvalContext ¶
func (w *ContextGraphWalker) EvalContext() EvalContext
func (*ContextGraphWalker) Execute ¶
func (w *ContextGraphWalker) Execute(ctx EvalContext, n GraphNodeExecutable) tfdiags.Diagnostics
type ContextMeta ¶
type ContextMeta struct { Env string // Env is the state environment // OriginalWorkingDir is the working directory where the OpenTofu CLI // was run from, which may no longer actually be the current working // directory if the user included the -chdir=... option. // // If this string is empty then the original working directory is the same // as the current working directory. // // In most cases we should respect the user's override by ignoring this // path and just using the current working directory, but this is here // for some exceptional cases where the original working directory is // needed. OriginalWorkingDir string }
ContextMeta is metadata about the running context. This is information that this package or structure cannot determine on its own but exposes into OpenTofu in various ways. This must be provided by the Context initializer.
type ContextOpts ¶
type ContextOpts struct { Meta *ContextMeta Hooks []Hook Parallelism int Providers map[addrs.Provider]providers.Factory Provisioners map[string]provisioners.Factory UIInput UIInput }
ContextOpts are the user-configurable options to create a context with NewContext.
type DestroyEdgeTransformer ¶
type DestroyEdgeTransformer struct { // FIXME: GraphNodeCreators are not always applying changes, and should not // participate in the destroy graph if there are no operations which could // interract with destroy nodes. We need Changes for now to detect the // action type, but perhaps this should be indicated somehow by the // DiffTransformer which was intended to be the only transformer operating // from the change set. Changes *plans.Changes // FIXME: Operation will not be needed here one we can better track // inter-provider dependencies and remove the cycle checks in // tryInterProviderDestroyEdge. Operation walkOperation }
DestroyEdgeTransformer is a GraphTransformer that creates the proper references for destroy resources. Destroy resources are more complex in that they must be depend on the destruction of resources that in turn depend on the CREATION of the node being destroy.
That is complicated. Visually:
B_d -> A_d -> A -> B
Notice that A destroy depends on B destroy, while B create depends on A create. They're inverted. This must be done for example because often dependent resources will block parent resources from deleting. Concrete example: VPC with subnets, the VPC can't be deleted while there are still subnets.
func (*DestroyEdgeTransformer) Transform ¶
func (t *DestroyEdgeTransformer) Transform(g *Graph) error
type DiffTransformer ¶
type DiffTransformer struct { Concrete ConcreteResourceInstanceNodeFunc State *states.State Changes *plans.Changes Config *configs.Config }
DiffTransformer is a GraphTransformer that adds graph nodes representing each of the resource changes described in the given Changes object.
func (*DiffTransformer) Transform ¶
func (t *DiffTransformer) Transform(g *Graph) error
type EvalContext ¶
type EvalContext interface { // Stopped returns a channel that is closed when evaluation is stopped // via tofu.Context.Stop() Stopped() <-chan struct{} // Path is the current module path. Path() addrs.ModuleInstance // Hook is used to call hook methods. The callback is called for each // hook and should return the hook action to take and the error. Hook(func(Hook) (HookAction, error)) error // Input is the UIInput object for interacting with the UI. Input() UIInput // InitProvider initializes the provider with the given address, and returns // the implementation of the resource provider or an error. // // It is an error to initialize the same provider more than once. This // method will panic if the module instance address of the given provider // configuration does not match the Path() of the EvalContext. InitProvider(addr addrs.AbsProviderConfig) (providers.Interface, error) // Provider gets the provider instance with the given address (already // initialized) or returns nil if the provider isn't initialized. // // This method expects an _absolute_ provider configuration address, since // resources in one module are able to use providers from other modules. // InitProvider must've been called on the EvalContext of the module // that owns the given provider before calling this method. Provider(addrs.AbsProviderConfig) providers.Interface // ProviderSchema retrieves the schema for a particular provider, which // must have already been initialized with InitProvider. // // This method expects an _absolute_ provider configuration address, since // resources in one module are able to use providers from other modules. ProviderSchema(addrs.AbsProviderConfig) (providers.ProviderSchema, error) // CloseProvider closes provider connections that aren't needed anymore. // // This method will panic if the module instance address of the given // provider configuration does not match the Path() of the EvalContext. CloseProvider(addrs.AbsProviderConfig) error // ConfigureProvider configures the provider with the given // configuration. This is a separate context call because this call // is used to store the provider configuration for inheritance lookups // with ParentProviderConfig(). // // This method will panic if the module instance address of the given // provider configuration does not match the Path() of the EvalContext. ConfigureProvider(addrs.AbsProviderConfig, cty.Value) tfdiags.Diagnostics // ProviderInput and SetProviderInput are used to configure providers // from user input. // // These methods will panic if the module instance address of the given // provider configuration does not match the Path() of the EvalContext. ProviderInput(addrs.AbsProviderConfig) map[string]cty.Value SetProviderInput(addrs.AbsProviderConfig, map[string]cty.Value) // Provisioner gets the provisioner instance with the given name. Provisioner(string) (provisioners.Interface, error) // ProvisionerSchema retrieves the main configuration schema for a // particular provisioner, which must have already been initialized with // InitProvisioner. ProvisionerSchema(string) (*configschema.Block, error) // CloseProvisioner closes all provisioner plugins. CloseProvisioners() error // EvaluateBlock takes the given raw configuration block and associated // schema and evaluates it to produce a value of an object type that // conforms to the implied type of the schema. // // The "self" argument is optional. If given, it is the referenceable // address that the name "self" should behave as an alias for when // evaluating. Set this to nil if the "self" object should not be available. // // The "key" argument is also optional. If given, it is the instance key // of the current object within the multi-instance container it belongs // to. For example, on a resource block with "count" set this should be // set to a different addrs.IntKey for each instance created from that // block. Set this to addrs.NoKey if not appropriate. // // The returned body is an expanded version of the given body, with any // "dynamic" blocks replaced with zero or more static blocks. This can be // used to extract correct source location information about attributes of // the returned object value. EvaluateBlock(body hcl.Body, schema *configschema.Block, self addrs.Referenceable, keyData InstanceKeyEvalData) (cty.Value, hcl.Body, tfdiags.Diagnostics) // EvaluateExpr takes the given HCL expression and evaluates it to produce // a value. // // The "self" argument is optional. If given, it is the referenceable // address that the name "self" should behave as an alias for when // evaluating. Set this to nil if the "self" object should not be available. EvaluateExpr(expr hcl.Expression, wantType cty.Type, self addrs.Referenceable) (cty.Value, tfdiags.Diagnostics) // EvaluateReplaceTriggeredBy takes the raw reference expression from the // config, and returns the evaluated *addrs.Reference along with a boolean // indicating if that reference forces replacement. EvaluateReplaceTriggeredBy(expr hcl.Expression, repData instances.RepetitionData) (*addrs.Reference, bool, tfdiags.Diagnostics) // EvaluationScope returns a scope that can be used to evaluate reference // addresses in this context. EvaluationScope(self addrs.Referenceable, source addrs.Referenceable, keyData InstanceKeyEvalData) *lang.Scope // SetRootModuleArgument defines the value for one variable of the root // module. The caller must ensure that given value is a suitable // "final value" for the variable, which means that it's already converted // and validated to match any configured constraints and validation rules. // // Calling this function multiple times with the same variable address // will silently overwrite the value provided by a previous call. SetRootModuleArgument(addrs.InputVariable, cty.Value) // SetModuleCallArgument defines the value for one input variable of a // particular child module call. The caller must ensure that the given // value is a suitable "final value" for the variable, which means that // it's already converted and validated to match any configured // constraints and validation rules. // // Calling this function multiple times with the same variable address // will silently overwrite the value provided by a previous call. SetModuleCallArgument(addrs.ModuleCallInstance, addrs.InputVariable, cty.Value) // GetVariableValue returns the value provided for the input variable with // the given address, or cty.DynamicVal if the variable hasn't been assigned // a value yet. // // Most callers should deal with variable values only indirectly via // EvaluationScope and the other expression evaluation functions, but // this is provided because variables tend to be evaluated outside of // the context of the module they belong to and so we sometimes need to // override the normal expression evaluation behavior. GetVariableValue(addr addrs.AbsInputVariableInstance) cty.Value // Changes returns the writer object that can be used to write new proposed // changes into the global changes set. Changes() *plans.ChangesSync // State returns a wrapper object that provides safe concurrent access to // the global state. State() *states.SyncState // Checks returns the object that tracks the state of any custom checks // declared in the configuration. Checks() *checks.State // RefreshState returns a wrapper object that provides safe concurrent // access to the state used to store the most recently refreshed resource // values. RefreshState() *states.SyncState // PrevRunState returns a wrapper object that provides safe concurrent // access to the state which represents the result of the previous run, // updated only so that object data conforms to current schemas for // meaningful comparison with RefreshState. PrevRunState() *states.SyncState // InstanceExpander returns a helper object for tracking the expansion of // graph nodes during the plan phase in response to "count" and "for_each" // arguments. // // The InstanceExpander is a global object that is shared across all of the // EvalContext objects for a given configuration. InstanceExpander() *instances.Expander // MoveResults returns a map describing the results of handling any // resource instance move statements prior to the graph walk, so that // the graph walk can then record that information appropriately in other // artifacts produced by the graph walk. // // This data structure is created prior to the graph walk and read-only // thereafter, so callers must not modify the returned map or any other // objects accessible through it. MoveResults() refactoring.MoveResults // WithPath returns a copy of the context with the internal path set to the // path argument. WithPath(path addrs.ModuleInstance) EvalContext }
EvalContext is the interface that is given to eval nodes to execute.
type EvalGraphBuilder ¶
type EvalGraphBuilder struct { // Config is the configuration tree. Config *configs.Config // State is the current state State *states.State // RootVariableValues are the raw input values for root input variables // given by the caller, which we'll resolve into final values as part // of the plan walk. RootVariableValues InputValues // Plugins is a library of plug-in components (providers and // provisioners) available for use. Plugins *contextPlugins }
EvalGraphBuilder implements GraphBuilder and constructs a graph suitable for evaluating in-memory values (input variables, local values, output values) in the state without any other side-effects.
This graph is used only in weird cases, such as the "tofu console" CLI command, where we need to evaluate expressions against the state without taking any other actions.
The generated graph will include nodes for providers, resources, etc just to allow indirect dependencies to be resolved, but these nodes will not take any actions themselves since we assume that their parts of the state, if any, are already complete.
Although the providers are never configured, they must still be available in order to obtain schema information used for type checking, etc.
func (*EvalGraphBuilder) Build ¶
func (b *EvalGraphBuilder) Build(path addrs.ModuleInstance) (*Graph, tfdiags.Diagnostics)
See GraphBuilder
func (*EvalGraphBuilder) Steps ¶
func (b *EvalGraphBuilder) Steps() []GraphTransformer
See GraphBuilder
type EvalOpts ¶
type EvalOpts struct {
SetVariables InputValues
}
type Evaluator ¶
type Evaluator struct { // Operation defines what type of operation this evaluator is being used // for. Operation walkOperation // Meta is contextual metadata about the current operation. Meta *ContextMeta // Config is the root node in the configuration tree. Config *configs.Config // VariableValues is a map from variable names to their associated values, // within the module indicated by ModulePath. VariableValues is modified // concurrently, and so it must be accessed only while holding // VariableValuesLock. // // The first map level is string representations of addr.ModuleInstance // values, while the second level is variable names. VariableValues map[string]map[string]cty.Value VariableValuesLock *sync.Mutex // Plugins is the library of available plugin components (providers and // provisioners) that we have available to help us evaluate expressions // that interact with plugin-provided objects. // // From this we only access the schemas of the plugins, and don't otherwise // interact with plugin instances. Plugins *contextPlugins // State is the current state, embedded in a wrapper that ensures that // it can be safely accessed and modified concurrently. State *states.SyncState // Changes is the set of proposed changes, embedded in a wrapper that // ensures they can be safely accessed and modified concurrently. Changes *plans.ChangesSync PlanTimestamp time.Time }
Evaluator provides the necessary contextual data for evaluating expressions for a particular walk operation.
func (*Evaluator) Scope ¶
func (e *Evaluator) Scope(data lang.Data, self addrs.Referenceable, source addrs.Referenceable) *lang.Scope
Scope creates an evaluation scope for the given module path and optional resource.
If the "self" argument is nil then the "self" object is not available in evaluated expressions. Otherwise, it behaves as an alias for the given address.
type ExternalReferenceTransformer ¶
ExternalReferenceTransformer will add a GraphNodeReferencer into the graph that makes no changes to the graph itself but, by referencing the addresses within ExternalReferences, ensures that any temporary nodes that are required by an external caller, such as the tofu testing framework, are not skipped because they are not referenced from within the module.
func (*ExternalReferenceTransformer) Transform ¶
func (t *ExternalReferenceTransformer) Transform(g *Graph) error
type ForcedCBDTransformer ¶
type ForcedCBDTransformer struct { }
ForcedCBDTransformer detects when a particular CBD-able graph node has dependencies with another that has create_before_destroy set that require it to be forced on, and forces it on.
This must be used in the plan graph builder to ensure that create_before_destroy settings are properly propagated before constructing the planned changes. This requires that the plannable resource nodes implement GraphNodeDestroyerCBD.
func (*ForcedCBDTransformer) Transform ¶
func (t *ForcedCBDTransformer) Transform(g *Graph) error
type Graph ¶
type Graph struct { // Graph is the actual DAG. This is embedded so you can call the DAG // methods directly. dag.AcyclicGraph // Path is the path in the module tree that this Graph represents. Path addrs.ModuleInstance }
Graph represents the graph that OpenTofu uses to represent resources and their dependencies.
func (*Graph) DirectedGraph ¶
func (*Graph) Walk ¶
func (g *Graph) Walk(walker GraphWalker) tfdiags.Diagnostics
Walk walks the graph with the given walker for callbacks. The graph will be walked with full parallelism, so the walker should expect to be called in concurrently.
type GraphBuilder ¶
type GraphBuilder interface { // Build builds the graph for the given module path. It is up to // the interface implementation whether this build should expand // the graph or not. Build(addrs.ModuleInstance) (*Graph, tfdiags.Diagnostics) }
GraphBuilder is an interface that can be implemented and used with OpenTofu to build the graph that OpenTofu walks.
type GraphNodeAttachDependencies ¶
type GraphNodeAttachDependencies interface { GraphNodeConfigResource AttachDependencies([]addrs.ConfigResource) }
type GraphNodeAttachProvider ¶
type GraphNodeAttachProvider interface { // ProviderName with no module prefix. Example: "aws". ProviderAddr() addrs.AbsProviderConfig // Sets the configuration AttachProvider(*configs.Provider) }
GraphNodeAttachProvider is an interface that must be implemented by nodes that want provider configurations attached.
type GraphNodeAttachProviderConfigSchema ¶
type GraphNodeAttachProviderConfigSchema interface { GraphNodeProvider AttachProviderConfigSchema(*configschema.Block) }
GraphNodeAttachProviderConfigSchema is an interface implemented by node types that need a provider configuration schema attached.
type GraphNodeAttachProviderMetaConfigs ¶
type GraphNodeAttachProviderMetaConfigs interface { GraphNodeConfigResource // Sets the configuration AttachProviderMetaConfigs(map[addrs.Provider]*configs.ProviderMeta) }
GraphNodeAttachProviderMetaConfigs is an interface that must be implemented by nodes that want provider meta configurations attached.
type GraphNodeAttachProvisionerSchema ¶
type GraphNodeAttachProvisionerSchema interface { ProvisionedBy() []string // SetProvisionerSchema is called during transform for each provisioner // type returned from ProvisionedBy, providing the configuration schema // for each provisioner in turn. The implementer should save these for // later use in evaluating provisioner configuration blocks. AttachProvisionerSchema(name string, schema *configschema.Block) }
GraphNodeAttachProvisionerSchema is an interface implemented by node types that need one or more provisioner schemas attached.
type GraphNodeAttachResourceConfig ¶
type GraphNodeAttachResourceConfig interface { GraphNodeConfigResource // Sets the configuration AttachResourceConfig(*configs.Resource) }
GraphNodeAttachResourceConfig is an interface that must be implemented by nodes that want resource configurations attached.
type GraphNodeAttachResourceSchema ¶
type GraphNodeAttachResourceSchema interface { GraphNodeConfigResource GraphNodeProviderConsumer AttachResourceSchema(schema *configschema.Block, version uint64) }
GraphNodeAttachResourceSchema is an interface implemented by node types that need a resource schema attached.
type GraphNodeAttachResourceState ¶
type GraphNodeAttachResourceState interface { GraphNodeResourceInstance // Sets the state AttachResourceState(*states.Resource) }
GraphNodeAttachResourceState is an interface that can be implemented to request that a ResourceState is attached to the node.
Due to a historical naming inconsistency, the type ResourceState actually represents the state for a particular _instance_, while InstanceState represents the values for that instance during a particular phase (e.g. primary vs. deposed). Consequently, GraphNodeAttachResourceState is supported only for nodes that represent resource instances, even though the name might suggest it is for containing resources.
type GraphNodeCloseProvider ¶
type GraphNodeCloseProvider interface { GraphNodeModulePath CloseProviderAddr() addrs.AbsProviderConfig }
GraphNodeCloseProvider is an interface that nodes that can be a close provider must implement. The CloseProviderName returned is the name of the provider they satisfy.
type GraphNodeConfigResource ¶
type GraphNodeConfigResource interface {
ResourceAddr() addrs.ConfigResource
}
GraphNodeConfigResource is implemented by any nodes that represent a resource. The type of operation cannot be assumed, only that this node represents the given resource.
type GraphNodeCreator ¶
type GraphNodeCreator interface { // CreateAddr is the address of the resource being created or updated CreateAddr() *addrs.AbsResourceInstance }
GraphNodeCreator must be implemented by nodes that create OR update resources.
type GraphNodeDeposedResourceInstanceObject ¶
type GraphNodeDeposedResourceInstanceObject interface {
DeposedInstanceObjectKey() states.DeposedKey
}
type GraphNodeDeposer ¶
type GraphNodeDeposer interface { // SetPreallocatedDeposedKey will be called during graph construction // if a particular node must use a pre-allocated deposed key if/when it // "deposes" the current object of its associated resource instance. SetPreallocatedDeposedKey(key states.DeposedKey) }
GraphNodeDeposer is an optional interface implemented by graph nodes that might create a single new deposed object for a specific associated resource instance, allowing a caller to optionally pre-allocate a DeposedKey for it.
type GraphNodeDestroyer ¶
type GraphNodeDestroyer interface { dag.Vertex // DestroyAddr is the address of the resource that is being // destroyed by this node. If this returns nil, then this node // is not destroying anything. DestroyAddr() *addrs.AbsResourceInstance }
GraphNodeDestroyer must be implemented by nodes that destroy resources.
type GraphNodeDestroyerCBD ¶
type GraphNodeDestroyerCBD interface { // CreateBeforeDestroy returns true if this node represents a node // that is doing a CBD. CreateBeforeDestroy() bool // ModifyCreateBeforeDestroy is called when the CBD state of a node // is changed dynamically. This can return an error if this isn't // allowed. ModifyCreateBeforeDestroy(bool) error }
GraphNodeDestroyerCBD must be implemented by nodes that might be create-before-destroy destroyers, or might plan a create-before-destroy action.
type GraphNodeDynamicExpandable ¶
type GraphNodeDynamicExpandable interface { // DynamicExpand returns a new graph which will be treated as the dynamic // subgraph of the receiving node. // // The second return value is of type error for historical reasons; // it's valid (and most ideal) for DynamicExpand to return the result // of calling ErrWithWarnings on a tfdiags.Diagnostics value instead, // in which case the caller will unwrap it and gather the individual // diagnostics. DynamicExpand(EvalContext) (*Graph, error) }
GraphNodeDynamicExpandable is an interface that nodes can implement to signal that they can be expanded at eval-time (hence dynamic). These nodes are given the eval context and are expected to return a new subgraph.
type GraphNodeExecutable ¶
type GraphNodeExecutable interface {
Execute(EvalContext, walkOperation) tfdiags.Diagnostics
}
GraphNodeExecutable is the interface that graph nodes must implement to enable execution.
type GraphNodeModuleInstance ¶
type GraphNodeModuleInstance interface {
Path() addrs.ModuleInstance
}
GraphNodeModuleInstance says that a node is part of a graph with a different path, and the context should be adjusted accordingly.
type GraphNodeModulePath ¶
GraphNodeModulePath is implemented by all referenceable nodes, to indicate their configuration path in unexpanded modules.
type GraphNodeProvider ¶
type GraphNodeProvider interface { GraphNodeModulePath ProviderAddr() addrs.AbsProviderConfig Name() string }
GraphNodeProvider is an interface that nodes that can be a provider must implement.
ProviderAddr returns the address of the provider configuration this satisfies, which is relative to the path returned by method Path().
Name returns the full name of the provider in the config.
type GraphNodeProviderConsumer ¶
type GraphNodeProviderConsumer interface { GraphNodeModulePath // ProvidedBy returns the address of the provider configuration the node // refers to, if available. The following value types may be returned: // // nil + exact true: the node does not require a provider // * addrs.LocalProviderConfig: the provider was set in the resource config // * addrs.AbsProviderConfig + exact true: the provider configuration was // taken from the instance state. // * addrs.AbsProviderConfig + exact false: no config or state; the returned // value is a default provider configuration address for the resource's // Provider ProvidedBy() (addr addrs.ProviderConfig, exact bool) // Provider() returns the Provider FQN for the node. Provider() (provider addrs.Provider) // Set the resolved provider address for this resource. SetProvider(addrs.AbsProviderConfig) }
GraphNodeProviderConsumer is an interface that nodes that require a provider must implement. ProvidedBy must return the address of the provider to use, which will be resolved to a configuration either in the same module or in an ancestor module, with the resulting absolute address passed to SetProvider.
type GraphNodeProvisionerConsumer ¶
type GraphNodeProvisionerConsumer interface {
ProvisionedBy() []string
}
GraphNodeProvisionerConsumer is an interface that nodes that require a provisioner must implement. ProvisionedBy must return the names of the provisioners to use.
type GraphNodeReferenceOutside ¶
type GraphNodeReferenceOutside interface { // ReferenceOutside returns a path in which any references from this node // are resolved. ReferenceOutside() (selfPath, referencePath addrs.Module) }
GraphNodeReferenceOutside is an interface that can optionally be implemented. A node that implements it can specify that its own referenceable addresses and/or the addresses it references are in a different module than the node itself.
Any referenceable addresses returned by ReferenceableAddrs are interpreted relative to the returned selfPath.
Any references returned by References are interpreted relative to the returned referencePath.
It is valid but not required for either of these paths to match what is returned by method Path, though if both match the main Path then there is no reason to implement this method.
The primary use-case for this is the nodes representing module input variables, since their expressions are resolved in terms of their calling module, but they are still referenced from their own module.
type GraphNodeReferenceable ¶
type GraphNodeReferenceable interface { GraphNodeModulePath // ReferenceableAddrs returns a list of addresses through which this can be // referenced. ReferenceableAddrs() []addrs.Referenceable }
GraphNodeReferenceable must be implemented by any node that represents a OpenTofu thing that can be referenced (resource, module, etc.).
Even if the thing has no name, this should return an empty list. By implementing this and returning a non-nil result, you say that this CAN be referenced and other methods of referencing may still be possible (such as by path!)
type GraphNodeReferencer ¶
type GraphNodeReferencer interface { GraphNodeModulePath // References returns a list of references made by this node, which // include both a referenced address and source location information for // the reference. References() []*addrs.Reference }
GraphNodeReferencer must be implemented by nodes that reference other OpenTofu items and therefore depend on them.
type GraphNodeResourceInstance ¶
type GraphNodeResourceInstance interface { ResourceInstanceAddr() addrs.AbsResourceInstance // StateDependencies returns any inter-resource dependencies that are // stored in the state. StateDependencies() []addrs.ConfigResource }
GraphNodeResourceInstance is implemented by any nodes that represent a resource instance. A single resource may have multiple instances if, for example, the "count" or "for_each" argument is used for it in configuration.
type GraphNodeTargetable ¶
type GraphNodeTargetable interface {
SetTargets([]addrs.Targetable)
}
GraphNodeTargetable is an interface for graph nodes to implement when they need to be told about incoming targets. This is useful for nodes that need to respect targets as they dynamically expand. Note that the list of targets provided will contain every target provided, and each implementing graph node must filter this list to targets considered relevant.
type GraphTransformer ¶
GraphTransformer is the interface that transformers implement. This interface is only for transforms that need entire graph visibility.
func GraphTransformMulti ¶
func GraphTransformMulti(ts ...GraphTransformer) GraphTransformer
GraphTransformMulti combines multiple graph transformers into a single GraphTransformer that runs all the individual graph transformers.
type GraphVertexTransformer ¶
GraphVertexTransformer is an interface that transforms a single Vertex within with graph. This is a specialization of GraphTransformer that makes it easy to do vertex replacement.
The GraphTransformer that runs through the GraphVertexTransformers is VertexTransformer.
type GraphWalker ¶
type GraphWalker interface { EvalContext() EvalContext EnterPath(addrs.ModuleInstance) EvalContext ExitPath(addrs.ModuleInstance) Execute(EvalContext, GraphNodeExecutable) tfdiags.Diagnostics }
GraphWalker is an interface that can be implemented that when used with Graph.Walk will invoke the given callbacks under certain events.
type Hook ¶
type Hook interface { // PreApply and PostApply are called before and after an action for a // single instance is applied. The error argument in PostApply is the // error, if any, that was returned from the provider Apply call itself. PreApply(addr addrs.AbsResourceInstance, gen states.Generation, action plans.Action, priorState, plannedNewState cty.Value) (HookAction, error) PostApply(addr addrs.AbsResourceInstance, gen states.Generation, newState cty.Value, err error) (HookAction, error) // PreDiff and PostDiff are called before and after a provider is given // the opportunity to customize the proposed new state to produce the // planned new state. PreDiff(addr addrs.AbsResourceInstance, gen states.Generation, priorState, proposedNewState cty.Value) (HookAction, error) PostDiff(addr addrs.AbsResourceInstance, gen states.Generation, action plans.Action, priorState, plannedNewState cty.Value) (HookAction, error) // The provisioning hooks signal both the overall start end end of // provisioning for a particular instance and of each of the individual // configured provisioners for each instance. The sequence of these // for a given instance might look something like this: // // PreProvisionInstance(aws_instance.foo[1], ...) // PreProvisionInstanceStep(aws_instance.foo[1], "file") // PostProvisionInstanceStep(aws_instance.foo[1], "file", nil) // PreProvisionInstanceStep(aws_instance.foo[1], "remote-exec") // ProvisionOutput(aws_instance.foo[1], "remote-exec", "Installing foo...") // ProvisionOutput(aws_instance.foo[1], "remote-exec", "Configuring bar...") // PostProvisionInstanceStep(aws_instance.foo[1], "remote-exec", nil) // PostProvisionInstance(aws_instance.foo[1], ...) // // ProvisionOutput is called with output sent back by the provisioners. // This will be called multiple times as output comes in, with each call // representing one line of output. It cannot control whether the // provisioner continues running. PreProvisionInstance(addr addrs.AbsResourceInstance, state cty.Value) (HookAction, error) PostProvisionInstance(addr addrs.AbsResourceInstance, state cty.Value) (HookAction, error) PreProvisionInstanceStep(addr addrs.AbsResourceInstance, typeName string) (HookAction, error) PostProvisionInstanceStep(addr addrs.AbsResourceInstance, typeName string, err error) (HookAction, error) ProvisionOutput(addr addrs.AbsResourceInstance, typeName string, line string) // PreRefresh and PostRefresh are called before and after a single // resource state is refreshed, respectively. PreRefresh(addr addrs.AbsResourceInstance, gen states.Generation, priorState cty.Value) (HookAction, error) PostRefresh(addr addrs.AbsResourceInstance, gen states.Generation, priorState cty.Value, newState cty.Value) (HookAction, error) // PreImportState and PostImportState are called before and after // (respectively) each state import operation for a given resource address when // using the legacy import command. PreImportState(addr addrs.AbsResourceInstance, importID string) (HookAction, error) PostImportState(addr addrs.AbsResourceInstance, imported []providers.ImportedResource) (HookAction, error) // PrePlanImport and PostPlanImport are called during a plan before and after planning to import // a new resource using the configuration-driven import workflow. PrePlanImport(addr addrs.AbsResourceInstance, importID string) (HookAction, error) PostPlanImport(addr addrs.AbsResourceInstance, imported []providers.ImportedResource) (HookAction, error) // PreApplyImport and PostApplyImport are called during an apply for each imported resource when // using the configuration-driven import workflow. PreApplyImport(addr addrs.AbsResourceInstance, importing plans.ImportingSrc) (HookAction, error) PostApplyImport(addr addrs.AbsResourceInstance, importing plans.ImportingSrc) (HookAction, error) // Stopping is called if an external signal requests that OpenTofu // gracefully abort an operation in progress. // // This notification might suggest that the user wants OpenTofu to exit // ASAP and in that case it's possible that if OpenTofu runs for too much // longer then it'll get killed un-gracefully, and so this hook could be // an opportunity to persist any transient data that would be lost under // a subsequent kill signal. However, implementations must take care to do // so in a way that won't cause corruption if the process _is_ killed while // this hook is still running. // // This hook cannot control whether OpenTofu continues, because the // graceful shutdown process is typically already running by the time this // function is called. Stopping() // PostStateUpdate is called each time the state is updated. It receives // a deep copy of the state, which it may therefore access freely without // any need for locks to protect from concurrent writes from the caller. PostStateUpdate(new *states.State) (HookAction, error) }
Hook is the interface that must be implemented to hook into various parts of OpenTofu, allowing you to inspect or change behavior at runtime.
There are MANY hook points into OpenTofu. If you only want to implement some hook points, but not all (which is the likely case), then embed the NilHook into your struct, which implements all of the interface but does nothing. Then, override only the functions you want to implement.
type HookAction ¶
type HookAction byte
HookAction is an enum of actions that can be taken as a result of a hook callback. This allows you to modify the behavior of OpenTofu at runtime.
const ( // HookActionContinue continues with processing as usual. HookActionContinue HookAction = iota // HookActionHalt halts immediately: no more hooks are processed // and the action that OpenTofu was about to take is cancelled. HookActionHalt )
type ImportOpts ¶
type ImportOpts struct { // Targets are the targets to import Targets []*ImportTarget // SetVariables are the variables set outside of the configuration, // such as on the command line, in variables files, etc. SetVariables InputValues }
ImportOpts are used as the configuration for Import.
type ImportTarget ¶
type ImportTarget struct { // Config is the original import block for this import. This might be null // if the import did not originate in config. Config *configs.Import // Addr is the address for the resource instance that the new object should // be imported into. Addr addrs.AbsResourceInstance // ID is the ID of the resource to import. This is resource-specific. ID hcl.Expression }
ImportTarget is a single resource to import, in legacy (CLI) import mode.
type InputMode ¶
type InputMode byte
InputMode defines what sort of input will be asked for when Input is called on Context.
const ( // InputModeProvider asks for provider variables InputModeProvider InputMode = 1 << iota // InputModeStd is the standard operating mode and asks for both variables // and providers. InputModeStd = InputModeProvider )
type InputOpts ¶
type InputOpts struct { // Id is a unique ID for the question being asked that might be // used for logging or to look up a prior answered question. Id string // Query is a human-friendly question for inputting this value. Query string // Description is a description about what this option is. Be wary // that this will probably be in a terminal so split lines as you see // necessary. Description string // Default will be the value returned if no data is entered. Default string // Secret should be true if we are asking for sensitive input. // If attached to a TTY, OpenTofu will disable echo. Secret bool }
InputOpts are options for asking for input.
type InputValue ¶
type InputValue struct { // Value is the raw value as provided by the user as part of the plan // options, or a corresponding similar data structure for non-plan // operations. // // If a particular variable declared in the root module is _not_ set by // the user then the caller must still provide an InputValue for it but // must set Value to cty.NilVal to represent the absense of a value. // This requirement is to help detect situations where the caller isn't // correctly detecting and handling all of the declared variables. // // For historical reasons it's important that callers distinguish the // situation of the value not being set at all (cty.NilVal) from the // situation of it being explicitly set to null (a cty.NullVal result): // for "nullable" input variables that distinction unfortunately decides // whether the final value will be the variable's default or will be // explicitly null. Value cty.Value // SourceType is a high-level category for where the value of Value // came from, which OpenTofu Core uses to tailor some of its error // messages to be more helpful to the user. // // Some SourceType values should be accompanied by a populated SourceRange // value. See that field's documentation below for more information. SourceType ValueSourceType // SourceRange provides source location information for values whose // SourceType is either ValueFromConfig, ValueFromNamedFile, or // ValueForNormalFile. It is not populated for other source types, and so // should not be used. SourceRange tfdiags.SourceRange }
InputValue represents a raw value for a root module input variable as provided by the external caller into a function like tofu.Context.Plan.
InputValue should represent as directly as possible what the user set the variable to, without any attempt to convert the value to the variable's type constraint or substitute the configured default values for variables that wasn't set. Those adjustments will be handled by OpenTofu Core itself as part of performing the requested operation.
A OpenTofu Core caller must provide an InputValue object for each of the variables declared in the root module, even if the end user didn't provide an explicit value for some of them. See the Value field documentation for how to handle that situation.
OpenTofu Core also internally uses InputValue to represent the raw value provided for a variable in a child module call, following the same conventions. However, that's an implementation detail not visible to outside callers.
func (*InputValue) GoString ¶
func (v *InputValue) GoString() string
func (*InputValue) HasSourceRange ¶
func (v *InputValue) HasSourceRange() bool
HasSourceRange returns true if the reciever has a source type for which we expect the SourceRange field to be populated with a valid range.
type InputValues ¶
type InputValues map[string]*InputValue
InputValues is a map of InputValue instances.
func InputValuesFromCaller ¶
func InputValuesFromCaller(vals map[string]cty.Value) InputValues
InputValuesFromCaller turns the given map of naked values into an InputValues that attributes each value to "a caller", using the source type ValueFromCaller. This is primarily useful for testing purposes.
This should not be used as a general way to convert map[string]cty.Value into InputValues, since in most real cases we want to set a suitable other SourceType and possibly SourceRange value.
func (InputValues) HasValues ¶
func (vv InputValues) HasValues(vals map[string]cty.Value) bool
HasValues returns true if the reciever has the same values as in the given map, disregarding the source types and source ranges.
Values are compared using the cty "RawEquals" method, which means that unknown values can be considered equal to one another if they are of the same type.
func (InputValues) Identical ¶
func (vv InputValues) Identical(other InputValues) bool
Identical returns true if the given InputValues has the same values, source types, and source ranges as the receiver.
Values are compared using the cty "RawEquals" method, which means that unknown values can be considered equal to one another if they are of the same type.
This method is primarily for testing. For most practical purposes, it's better to use SameValues or HasValues.
func (InputValues) JustValues ¶
func (vv InputValues) JustValues() map[string]cty.Value
JustValues returns a map that just includes the values, discarding the source information.
func (InputValues) Override ¶
func (vv InputValues) Override(others ...InputValues) InputValues
Override merges the given value maps with the receiver, overriding any conflicting keys so that the latest definition wins.
func (InputValues) SameValues ¶
func (vv InputValues) SameValues(other InputValues) bool
SameValues returns true if the given InputValues has the same values as the receiever, disregarding the source types and source ranges.
Values are compared using the cty "RawEquals" method, which means that unknown values can be considered equal to one another if they are of the same type.
type InstanceKeyEvalData ¶
type InstanceKeyEvalData = instances.RepetitionData
InstanceKeyEvalData is the old name for instances.RepetitionData, aliased here for compatibility. In new code, use instances.RepetitionData instead.
func EvalDataForInstanceKey ¶
func EvalDataForInstanceKey(key addrs.InstanceKey, forEachMap map[string]cty.Value) InstanceKeyEvalData
EvalDataForInstanceKey constructs a suitable InstanceKeyEvalData for evaluating in a context that has the given instance key.
The forEachMap argument can be nil when preparing for evaluation in a context where each.value is prohibited, such as a destroy-time provisioner. In that case, the returned EachValue will always be cty.NilVal.
type LocalTransformer ¶
LocalTransformer is a GraphTransformer that adds all the local values from the configuration to the graph.
func (*LocalTransformer) Transform ¶
func (t *LocalTransformer) Transform(g *Graph) error
type MissingProviderTransformer ¶
type MissingProviderTransformer struct { // MissingProviderTransformer needs the config to rule out _implied_ default providers Config *configs.Config // Concrete, if set, overrides how the providers are made. Concrete ConcreteProviderNodeFunc }
MissingProviderTransformer is a GraphTransformer that adds to the graph a node for each default provider configuration that is referenced by another node but not already present in the graph.
These "default" nodes are always added to the root module, regardless of where they are requested. This is important because our inheritance resolution behavior in ProviderTransformer will then treat these as a last-ditch fallback after walking up the tree, rather than preferring them as it would if they were placed in the same module as the requester.
This transformer may create extra nodes that are not needed in practice, due to overriding provider configurations in child modules. PruneProviderTransformer can then remove these once ProviderTransformer has resolved all of the inheritence, etc.
func (*MissingProviderTransformer) Transform ¶
func (t *MissingProviderTransformer) Transform(g *Graph) error
type MockEvalContext ¶
type MockEvalContext struct { StoppedCalled bool StoppedValue <-chan struct{} HookCalled bool HookHook Hook HookError error InputCalled bool InputInput UIInput InitProviderCalled bool InitProviderType string InitProviderAddr addrs.AbsProviderConfig InitProviderProvider providers.Interface InitProviderError error ProviderCalled bool ProviderAddr addrs.AbsProviderConfig ProviderProvider providers.Interface ProviderSchemaCalled bool ProviderSchemaAddr addrs.AbsProviderConfig ProviderSchemaSchema providers.ProviderSchema ProviderSchemaError error CloseProviderCalled bool CloseProviderAddr addrs.AbsProviderConfig CloseProviderProvider providers.Interface ProviderInputCalled bool ProviderInputAddr addrs.AbsProviderConfig ProviderInputValues map[string]cty.Value SetProviderInputCalled bool SetProviderInputAddr addrs.AbsProviderConfig SetProviderInputValues map[string]cty.Value ConfigureProviderFn func( addr addrs.AbsProviderConfig, cfg cty.Value) tfdiags.Diagnostics // overrides the other values below, if set ConfigureProviderCalled bool ConfigureProviderAddr addrs.AbsProviderConfig ConfigureProviderConfig cty.Value ConfigureProviderDiags tfdiags.Diagnostics ProvisionerCalled bool ProvisionerName string ProvisionerProvisioner provisioners.Interface ProvisionerSchemaCalled bool ProvisionerSchemaName string ProvisionerSchemaSchema *configschema.Block ProvisionerSchemaError error CloseProvisionersCalled bool EvaluateBlockCalled bool EvaluateBlockBody hcl.Body EvaluateBlockSchema *configschema.Block EvaluateBlockSelf addrs.Referenceable EvaluateBlockKeyData InstanceKeyEvalData EvaluateBlockResultFunc func( body hcl.Body, schema *configschema.Block, self addrs.Referenceable, keyData InstanceKeyEvalData, ) (cty.Value, hcl.Body, tfdiags.Diagnostics) // overrides the other values below, if set EvaluateBlockResult cty.Value EvaluateBlockExpandedBody hcl.Body EvaluateBlockDiags tfdiags.Diagnostics EvaluateExprCalled bool EvaluateExprExpr hcl.Expression EvaluateExprWantType cty.Type EvaluateExprSelf addrs.Referenceable EvaluateExprResultFunc func( expr hcl.Expression, wantType cty.Type, self addrs.Referenceable, ) (cty.Value, tfdiags.Diagnostics) // overrides the other values below, if set EvaluateExprResult cty.Value EvaluateExprDiags tfdiags.Diagnostics EvaluationScopeCalled bool EvaluationScopeSelf addrs.Referenceable EvaluationScopeKeyData InstanceKeyEvalData EvaluationScopeScope *lang.Scope PathCalled bool PathPath addrs.ModuleInstance SetRootModuleArgumentCalled bool SetRootModuleArgumentAddr addrs.InputVariable SetRootModuleArgumentValue cty.Value SetRootModuleArgumentFunc func(addr addrs.InputVariable, v cty.Value) SetModuleCallArgumentCalled bool SetModuleCallArgumentModuleCall addrs.ModuleCallInstance SetModuleCallArgumentVariable addrs.InputVariable SetModuleCallArgumentValue cty.Value SetModuleCallArgumentFunc func(callAddr addrs.ModuleCallInstance, varAddr addrs.InputVariable, v cty.Value) GetVariableValueCalled bool GetVariableValueAddr addrs.AbsInputVariableInstance GetVariableValueValue cty.Value GetVariableValueFunc func(addr addrs.AbsInputVariableInstance) cty.Value // supersedes GetVariableValueValue ChangesCalled bool ChangesChanges *plans.ChangesSync StateCalled bool StateState *states.SyncState ChecksCalled bool ChecksState *checks.State RefreshStateCalled bool RefreshStateState *states.SyncState PrevRunStateCalled bool PrevRunStateState *states.SyncState MoveResultsCalled bool MoveResultsResults refactoring.MoveResults InstanceExpanderCalled bool InstanceExpanderExpander *instances.Expander }
MockEvalContext is a mock version of EvalContext that can be used for tests.
func (*MockEvalContext) Changes ¶
func (c *MockEvalContext) Changes() *plans.ChangesSync
func (*MockEvalContext) Checks ¶
func (c *MockEvalContext) Checks() *checks.State
func (*MockEvalContext) CloseProvider ¶
func (c *MockEvalContext) CloseProvider(addr addrs.AbsProviderConfig) error
func (*MockEvalContext) CloseProvisioners ¶
func (c *MockEvalContext) CloseProvisioners() error
func (*MockEvalContext) ConfigureProvider ¶
func (c *MockEvalContext) ConfigureProvider(addr addrs.AbsProviderConfig, cfg cty.Value) tfdiags.Diagnostics
func (*MockEvalContext) EvaluateBlock ¶
func (c *MockEvalContext) EvaluateBlock(body hcl.Body, schema *configschema.Block, self addrs.Referenceable, keyData InstanceKeyEvalData) (cty.Value, hcl.Body, tfdiags.Diagnostics)
func (*MockEvalContext) EvaluateExpr ¶
func (c *MockEvalContext) EvaluateExpr(expr hcl.Expression, wantType cty.Type, self addrs.Referenceable) (cty.Value, tfdiags.Diagnostics)
func (*MockEvalContext) EvaluateReplaceTriggeredBy ¶
func (c *MockEvalContext) EvaluateReplaceTriggeredBy(hcl.Expression, instances.RepetitionData) (*addrs.Reference, bool, tfdiags.Diagnostics)
func (*MockEvalContext) EvaluationScope ¶
func (c *MockEvalContext) EvaluationScope(self addrs.Referenceable, source addrs.Referenceable, keyData InstanceKeyEvalData) *lang.Scope
func (*MockEvalContext) GetVariableValue ¶
func (c *MockEvalContext) GetVariableValue(addr addrs.AbsInputVariableInstance) cty.Value
func (*MockEvalContext) Hook ¶
func (c *MockEvalContext) Hook(fn func(Hook) (HookAction, error)) error
func (*MockEvalContext) InitProvider ¶
func (c *MockEvalContext) InitProvider(addr addrs.AbsProviderConfig) (providers.Interface, error)
func (*MockEvalContext) Input ¶
func (c *MockEvalContext) Input() UIInput
func (*MockEvalContext) InstanceExpander ¶
func (c *MockEvalContext) InstanceExpander() *instances.Expander
func (*MockEvalContext) MoveResults ¶
func (c *MockEvalContext) MoveResults() refactoring.MoveResults
func (*MockEvalContext) Path ¶
func (c *MockEvalContext) Path() addrs.ModuleInstance
func (*MockEvalContext) PrevRunState ¶
func (c *MockEvalContext) PrevRunState() *states.SyncState
func (*MockEvalContext) Provider ¶
func (c *MockEvalContext) Provider(addr addrs.AbsProviderConfig) providers.Interface
func (*MockEvalContext) ProviderInput ¶
func (c *MockEvalContext) ProviderInput(addr addrs.AbsProviderConfig) map[string]cty.Value
func (*MockEvalContext) ProviderSchema ¶
func (c *MockEvalContext) ProviderSchema(addr addrs.AbsProviderConfig) (providers.ProviderSchema, error)
func (*MockEvalContext) Provisioner ¶
func (c *MockEvalContext) Provisioner(n string) (provisioners.Interface, error)
func (*MockEvalContext) ProvisionerSchema ¶
func (c *MockEvalContext) ProvisionerSchema(n string) (*configschema.Block, error)
func (*MockEvalContext) RefreshState ¶
func (c *MockEvalContext) RefreshState() *states.SyncState
func (*MockEvalContext) SetModuleCallArgument ¶
func (c *MockEvalContext) SetModuleCallArgument(callAddr addrs.ModuleCallInstance, varAddr addrs.InputVariable, v cty.Value)
func (*MockEvalContext) SetProviderInput ¶
func (c *MockEvalContext) SetProviderInput(addr addrs.AbsProviderConfig, vals map[string]cty.Value)
func (*MockEvalContext) SetRootModuleArgument ¶
func (c *MockEvalContext) SetRootModuleArgument(addr addrs.InputVariable, v cty.Value)
func (*MockEvalContext) State ¶
func (c *MockEvalContext) State() *states.SyncState
func (*MockEvalContext) Stopped ¶
func (c *MockEvalContext) Stopped() <-chan struct{}
func (*MockEvalContext) WithPath ¶
func (c *MockEvalContext) WithPath(path addrs.ModuleInstance) EvalContext
type MockHook ¶
type MockHook struct { sync.Mutex PreApplyCalled bool PreApplyAddr addrs.AbsResourceInstance PreApplyGen states.Generation PreApplyAction plans.Action PreApplyPriorState cty.Value PreApplyPlannedState cty.Value PreApplyReturn HookAction PreApplyError error PostApplyCalled bool PostApplyAddr addrs.AbsResourceInstance PostApplyGen states.Generation PostApplyNewState cty.Value PostApplyError error PostApplyReturn HookAction PostApplyReturnError error PostApplyFn func(addrs.AbsResourceInstance, states.Generation, cty.Value, error) (HookAction, error) PreDiffCalled bool PreDiffAddr addrs.AbsResourceInstance PreDiffGen states.Generation PreDiffPriorState cty.Value PreDiffProposedState cty.Value PreDiffReturn HookAction PreDiffError error PostDiffCalled bool PostDiffAddr addrs.AbsResourceInstance PostDiffGen states.Generation PostDiffAction plans.Action PostDiffPriorState cty.Value PostDiffPlannedState cty.Value PostDiffReturn HookAction PostDiffError error PreProvisionInstanceCalled bool PreProvisionInstanceAddr addrs.AbsResourceInstance PreProvisionInstanceState cty.Value PreProvisionInstanceReturn HookAction PreProvisionInstanceError error PostProvisionInstanceCalled bool PostProvisionInstanceAddr addrs.AbsResourceInstance PostProvisionInstanceState cty.Value PostProvisionInstanceReturn HookAction PostProvisionInstanceError error PreProvisionInstanceStepCalled bool PreProvisionInstanceStepAddr addrs.AbsResourceInstance PreProvisionInstanceStepProvisionerType string PreProvisionInstanceStepReturn HookAction PreProvisionInstanceStepError error PostProvisionInstanceStepCalled bool PostProvisionInstanceStepAddr addrs.AbsResourceInstance PostProvisionInstanceStepProvisionerType string PostProvisionInstanceStepErrorArg error PostProvisionInstanceStepReturn HookAction PostProvisionInstanceStepError error ProvisionOutputCalled bool ProvisionOutputAddr addrs.AbsResourceInstance ProvisionOutputProvisionerType string ProvisionOutputMessage string PreRefreshCalled bool PreRefreshAddr addrs.AbsResourceInstance PreRefreshGen states.Generation PreRefreshPriorState cty.Value PreRefreshReturn HookAction PreRefreshError error PostRefreshCalled bool PostRefreshAddr addrs.AbsResourceInstance PostRefreshGen states.Generation PostRefreshPriorState cty.Value PostRefreshNewState cty.Value PostRefreshReturn HookAction PostRefreshError error PreImportStateCalled bool PreImportStateAddr addrs.AbsResourceInstance PreImportStateID string PreImportStateReturn HookAction PreImportStateError error PostImportStateCalled bool PostImportStateAddr addrs.AbsResourceInstance PostImportStateNewStates []providers.ImportedResource PostImportStateReturn HookAction PostImportStateError error PrePlanImportCalled bool PrePlanImportAddr addrs.AbsResourceInstance PrePlanImportReturn HookAction PrePlanImportError error PostPlanImportAddr addrs.AbsResourceInstance PostPlanImportCalled bool PostPlanImportReturn HookAction PostPlanImportError error PreApplyImportCalled bool PreApplyImportAddr addrs.AbsResourceInstance PreApplyImportReturn HookAction PreApplyImportError error PostApplyImportCalled bool PostApplyImportAddr addrs.AbsResourceInstance PostApplyImportReturn HookAction PostApplyImportError error StoppingCalled bool PostStateUpdateCalled bool PostStateUpdateState *states.State PostStateUpdateReturn HookAction PostStateUpdateError error }
MockHook is an implementation of Hook that can be used for tests. It records all of its function calls.
func (*MockHook) PostApply ¶
func (h *MockHook) PostApply(addr addrs.AbsResourceInstance, gen states.Generation, newState cty.Value, err error) (HookAction, error)
func (*MockHook) PostApplyImport ¶
func (h *MockHook) PostApplyImport(addr addrs.AbsResourceInstance, importing plans.ImportingSrc) (HookAction, error)
func (*MockHook) PostDiff ¶
func (h *MockHook) PostDiff(addr addrs.AbsResourceInstance, gen states.Generation, action plans.Action, priorState, plannedNewState cty.Value) (HookAction, error)
func (*MockHook) PostImportState ¶
func (h *MockHook) PostImportState(addr addrs.AbsResourceInstance, imported []providers.ImportedResource) (HookAction, error)
func (*MockHook) PostPlanImport ¶
func (h *MockHook) PostPlanImport(addr addrs.AbsResourceInstance, imported []providers.ImportedResource) (HookAction, error)
func (*MockHook) PostProvisionInstance ¶
func (h *MockHook) PostProvisionInstance(addr addrs.AbsResourceInstance, state cty.Value) (HookAction, error)
func (*MockHook) PostProvisionInstanceStep ¶
func (h *MockHook) PostProvisionInstanceStep(addr addrs.AbsResourceInstance, typeName string, err error) (HookAction, error)
func (*MockHook) PostRefresh ¶
func (h *MockHook) PostRefresh(addr addrs.AbsResourceInstance, gen states.Generation, priorState cty.Value, newState cty.Value) (HookAction, error)
func (*MockHook) PostStateUpdate ¶
func (h *MockHook) PostStateUpdate(new *states.State) (HookAction, error)
func (*MockHook) PreApply ¶
func (h *MockHook) PreApply(addr addrs.AbsResourceInstance, gen states.Generation, action plans.Action, priorState, plannedNewState cty.Value) (HookAction, error)
func (*MockHook) PreApplyImport ¶
func (h *MockHook) PreApplyImport(addr addrs.AbsResourceInstance, importing plans.ImportingSrc) (HookAction, error)
func (*MockHook) PreDiff ¶
func (h *MockHook) PreDiff(addr addrs.AbsResourceInstance, gen states.Generation, priorState, proposedNewState cty.Value) (HookAction, error)
func (*MockHook) PreImportState ¶
func (h *MockHook) PreImportState(addr addrs.AbsResourceInstance, importID string) (HookAction, error)
func (*MockHook) PrePlanImport ¶
func (h *MockHook) PrePlanImport(addr addrs.AbsResourceInstance, importID string) (HookAction, error)
func (*MockHook) PreProvisionInstance ¶
func (h *MockHook) PreProvisionInstance(addr addrs.AbsResourceInstance, state cty.Value) (HookAction, error)
func (*MockHook) PreProvisionInstanceStep ¶
func (h *MockHook) PreProvisionInstanceStep(addr addrs.AbsResourceInstance, typeName string) (HookAction, error)
func (*MockHook) PreRefresh ¶
func (h *MockHook) PreRefresh(addr addrs.AbsResourceInstance, gen states.Generation, priorState cty.Value) (HookAction, error)
func (*MockHook) ProvisionOutput ¶
func (h *MockHook) ProvisionOutput(addr addrs.AbsResourceInstance, typeName string, line string)
type MockProvider ¶
type MockProvider struct { sync.Mutex // Anything you want, in case you need to store extra data with the mock. Meta interface{} GetProviderSchemaCalled bool GetProviderSchemaResponse *providers.GetProviderSchemaResponse ValidateProviderConfigCalled bool ValidateProviderConfigResponse *providers.ValidateProviderConfigResponse ValidateProviderConfigRequest providers.ValidateProviderConfigRequest ValidateProviderConfigFn func(providers.ValidateProviderConfigRequest) providers.ValidateProviderConfigResponse ValidateResourceConfigCalled bool ValidateResourceConfigTypeName string ValidateResourceConfigResponse *providers.ValidateResourceConfigResponse ValidateResourceConfigRequest providers.ValidateResourceConfigRequest ValidateResourceConfigFn func(providers.ValidateResourceConfigRequest) providers.ValidateResourceConfigResponse ValidateDataResourceConfigCalled bool ValidateDataResourceConfigTypeName string ValidateDataResourceConfigResponse *providers.ValidateDataResourceConfigResponse ValidateDataResourceConfigRequest providers.ValidateDataResourceConfigRequest ValidateDataResourceConfigFn func(providers.ValidateDataResourceConfigRequest) providers.ValidateDataResourceConfigResponse UpgradeResourceStateCalled bool UpgradeResourceStateTypeName string UpgradeResourceStateResponse *providers.UpgradeResourceStateResponse UpgradeResourceStateRequest providers.UpgradeResourceStateRequest UpgradeResourceStateFn func(providers.UpgradeResourceStateRequest) providers.UpgradeResourceStateResponse ConfigureProviderCalled bool ConfigureProviderResponse *providers.ConfigureProviderResponse ConfigureProviderRequest providers.ConfigureProviderRequest ConfigureProviderFn func(providers.ConfigureProviderRequest) providers.ConfigureProviderResponse StopCalled bool StopFn func() error StopResponse error ReadResourceCalled bool ReadResourceResponse *providers.ReadResourceResponse ReadResourceRequest providers.ReadResourceRequest ReadResourceFn func(providers.ReadResourceRequest) providers.ReadResourceResponse PlanResourceChangeCalled bool PlanResourceChangeResponse *providers.PlanResourceChangeResponse PlanResourceChangeRequest providers.PlanResourceChangeRequest PlanResourceChangeFn func(providers.PlanResourceChangeRequest) providers.PlanResourceChangeResponse ApplyResourceChangeCalled bool ApplyResourceChangeResponse *providers.ApplyResourceChangeResponse ApplyResourceChangeRequest providers.ApplyResourceChangeRequest ApplyResourceChangeFn func(providers.ApplyResourceChangeRequest) providers.ApplyResourceChangeResponse ImportResourceStateCalled bool ImportResourceStateResponse *providers.ImportResourceStateResponse ImportResourceStateRequest providers.ImportResourceStateRequest ImportResourceStateFn func(providers.ImportResourceStateRequest) providers.ImportResourceStateResponse ReadDataSourceCalled bool ReadDataSourceResponse *providers.ReadDataSourceResponse ReadDataSourceRequest providers.ReadDataSourceRequest ReadDataSourceFn func(providers.ReadDataSourceRequest) providers.ReadDataSourceResponse CloseCalled bool CloseError error }
MockProvider implements providers.Interface but mocks out all the calls for testing purposes.
func (*MockProvider) ApplyResourceChange ¶
func (p *MockProvider) ApplyResourceChange(r providers.ApplyResourceChangeRequest) (resp providers.ApplyResourceChangeResponse)
func (*MockProvider) Close ¶
func (p *MockProvider) Close() error
func (*MockProvider) ConfigureProvider ¶
func (p *MockProvider) ConfigureProvider(r providers.ConfigureProviderRequest) (resp providers.ConfigureProviderResponse)
func (*MockProvider) GetProviderSchema ¶
func (p *MockProvider) GetProviderSchema() providers.GetProviderSchemaResponse
func (*MockProvider) ImportResourceState ¶
func (p *MockProvider) ImportResourceState(r providers.ImportResourceStateRequest) (resp providers.ImportResourceStateResponse)
func (*MockProvider) PlanResourceChange ¶
func (p *MockProvider) PlanResourceChange(r providers.PlanResourceChangeRequest) (resp providers.PlanResourceChangeResponse)
func (*MockProvider) ReadDataSource ¶
func (p *MockProvider) ReadDataSource(r providers.ReadDataSourceRequest) (resp providers.ReadDataSourceResponse)
func (*MockProvider) ReadResource ¶
func (p *MockProvider) ReadResource(r providers.ReadResourceRequest) (resp providers.ReadResourceResponse)
func (*MockProvider) Stop ¶
func (p *MockProvider) Stop() error
func (*MockProvider) UpgradeResourceState ¶
func (p *MockProvider) UpgradeResourceState(r providers.UpgradeResourceStateRequest) (resp providers.UpgradeResourceStateResponse)
func (*MockProvider) ValidateDataResourceConfig ¶
func (p *MockProvider) ValidateDataResourceConfig(r providers.ValidateDataResourceConfigRequest) (resp providers.ValidateDataResourceConfigResponse)
func (*MockProvider) ValidateProviderConfig ¶
func (p *MockProvider) ValidateProviderConfig(r providers.ValidateProviderConfigRequest) (resp providers.ValidateProviderConfigResponse)
func (*MockProvider) ValidateResourceConfig ¶
func (p *MockProvider) ValidateResourceConfig(r providers.ValidateResourceConfigRequest) (resp providers.ValidateResourceConfigResponse)
type MockProvisioner ¶
type MockProvisioner struct { sync.Mutex // Anything you want, in case you need to store extra data with the mock. Meta interface{} GetSchemaCalled bool GetSchemaResponse provisioners.GetSchemaResponse ValidateProvisionerConfigCalled bool ValidateProvisionerConfigRequest provisioners.ValidateProvisionerConfigRequest ValidateProvisionerConfigResponse provisioners.ValidateProvisionerConfigResponse ValidateProvisionerConfigFn func(provisioners.ValidateProvisionerConfigRequest) provisioners.ValidateProvisionerConfigResponse ProvisionResourceCalled bool ProvisionResourceRequest provisioners.ProvisionResourceRequest ProvisionResourceResponse provisioners.ProvisionResourceResponse ProvisionResourceFn func(provisioners.ProvisionResourceRequest) provisioners.ProvisionResourceResponse StopCalled bool StopResponse error StopFn func() error CloseCalled bool CloseResponse error CloseFn func() error }
MockProvisioner implements provisioners.Interface but mocks out all the calls for testing purposes.
func (*MockProvisioner) Close ¶
func (p *MockProvisioner) Close() error
func (*MockProvisioner) GetSchema ¶
func (p *MockProvisioner) GetSchema() provisioners.GetSchemaResponse
func (*MockProvisioner) ProvisionResource ¶
func (p *MockProvisioner) ProvisionResource(r provisioners.ProvisionResourceRequest) provisioners.ProvisionResourceResponse
func (*MockProvisioner) Stop ¶
func (p *MockProvisioner) Stop() error
func (*MockProvisioner) ValidateProvisionerConfig ¶
func (p *MockProvisioner) ValidateProvisionerConfig(r provisioners.ValidateProvisionerConfigRequest) provisioners.ValidateProvisionerConfigResponse
type MockUIInput ¶
type MockUIInput struct { InputCalled bool InputOpts *InputOpts InputReturnMap map[string]string InputReturnString string InputReturnError error InputFn func(*InputOpts) (string, error) }
MockUIInput is an implementation of UIInput that can be used for tests.
type MockUIOutput ¶
type MockUIOutput struct { sync.Mutex OutputCalled bool OutputMessage string OutputFn func(string) }
MockUIOutput is an implementation of UIOutput that can be used for tests.
func (*MockUIOutput) Output ¶
func (o *MockUIOutput) Output(v string)
type ModuleExpansionTransformer ¶
type ModuleExpansionTransformer struct { Config *configs.Config // Concrete allows injection of a wrapped module node by the graph builder // to alter the evaluation behavior. Concrete ConcreteModuleNodeFunc // contains filtered or unexported fields }
ModuleExpansionTransformer is a GraphTransformer that adds graph nodes representing the possible expansion of each module call in the configuration, and ensures that any nodes representing objects declared within a module are dependent on the expansion node so that they will be visited only after the module expansion has been decided.
This transform must be applied only after all nodes representing objects that can be contained within modules have already been added.
func (*ModuleExpansionTransformer) Transform ¶
func (t *ModuleExpansionTransformer) Transform(g *Graph) error
type ModuleVariableTransformer ¶
ModuleVariableTransformer is a GraphTransformer that adds all the variables in the configuration to the graph.
Any "variable" block present in any non-root module is included here, even if a particular variable is not referenced from anywhere.
The transform will produce errors if a call to a module does not conform to the expected set of arguments, but this transformer is not in a good position to return errors and so the validate walk should include specific steps for validating module blocks, separate from this transform.
func (*ModuleVariableTransformer) Transform ¶
func (t *ModuleVariableTransformer) Transform(g *Graph) error
type NilHook ¶
type NilHook struct{}
NilHook is a Hook implementation that does nothing. It exists only to simplify implementing hooks. You can embed this into your Hook implementation and only implement the functions you are interested in.
func (*NilHook) PostApply ¶
func (*NilHook) PostApply(addr addrs.AbsResourceInstance, gen states.Generation, newState cty.Value, err error) (HookAction, error)
func (*NilHook) PostApplyImport ¶
func (h *NilHook) PostApplyImport(addr addrs.AbsResourceInstance, importing plans.ImportingSrc) (HookAction, error)
func (*NilHook) PostDiff ¶
func (*NilHook) PostDiff(addr addrs.AbsResourceInstance, gen states.Generation, action plans.Action, priorState, plannedNewState cty.Value) (HookAction, error)
func (*NilHook) PostImportState ¶
func (*NilHook) PostImportState(addr addrs.AbsResourceInstance, imported []providers.ImportedResource) (HookAction, error)
func (*NilHook) PostPlanImport ¶
func (h *NilHook) PostPlanImport(addr addrs.AbsResourceInstance, imported []providers.ImportedResource) (HookAction, error)
func (*NilHook) PostProvisionInstance ¶
func (*NilHook) PostProvisionInstance(addr addrs.AbsResourceInstance, state cty.Value) (HookAction, error)
func (*NilHook) PostProvisionInstanceStep ¶
func (*NilHook) PostProvisionInstanceStep(addr addrs.AbsResourceInstance, typeName string, err error) (HookAction, error)
func (*NilHook) PostRefresh ¶
func (*NilHook) PostRefresh(addr addrs.AbsResourceInstance, gen states.Generation, priorState cty.Value, newState cty.Value) (HookAction, error)
func (*NilHook) PostStateUpdate ¶
func (*NilHook) PostStateUpdate(new *states.State) (HookAction, error)
func (*NilHook) PreApply ¶
func (*NilHook) PreApply(addr addrs.AbsResourceInstance, gen states.Generation, action plans.Action, priorState, plannedNewState cty.Value) (HookAction, error)
func (*NilHook) PreApplyImport ¶
func (h *NilHook) PreApplyImport(addr addrs.AbsResourceInstance, importing plans.ImportingSrc) (HookAction, error)
func (*NilHook) PreDiff ¶
func (*NilHook) PreDiff(addr addrs.AbsResourceInstance, gen states.Generation, priorState, proposedNewState cty.Value) (HookAction, error)
func (*NilHook) PreImportState ¶
func (*NilHook) PreImportState(addr addrs.AbsResourceInstance, importID string) (HookAction, error)
func (*NilHook) PrePlanImport ¶
func (h *NilHook) PrePlanImport(addr addrs.AbsResourceInstance, importID string) (HookAction, error)
func (*NilHook) PreProvisionInstance ¶
func (*NilHook) PreProvisionInstance(addr addrs.AbsResourceInstance, state cty.Value) (HookAction, error)
func (*NilHook) PreProvisionInstanceStep ¶
func (*NilHook) PreProvisionInstanceStep(addr addrs.AbsResourceInstance, typeName string) (HookAction, error)
func (*NilHook) PreRefresh ¶
func (*NilHook) PreRefresh(addr addrs.AbsResourceInstance, gen states.Generation, priorState cty.Value) (HookAction, error)
func (*NilHook) ProvisionOutput ¶
func (*NilHook) ProvisionOutput(addr addrs.AbsResourceInstance, typeName string, line string)
type NodeAbstractProvider ¶
type NodeAbstractProvider struct { Addr addrs.AbsProviderConfig Config *configs.Provider Schema *configschema.Block }
NodeAbstractProvider represents a provider that has no associated operations. It registers all the common interfaces across operations for providers.
func (*NodeAbstractProvider) AttachProvider ¶
func (n *NodeAbstractProvider) AttachProvider(c *configs.Provider)
GraphNodeAttachProvider
func (*NodeAbstractProvider) AttachProviderConfigSchema ¶
func (n *NodeAbstractProvider) AttachProviderConfigSchema(schema *configschema.Block)
GraphNodeAttachProviderConfigSchema impl.
func (*NodeAbstractProvider) ModulePath ¶
func (n *NodeAbstractProvider) ModulePath() addrs.Module
GraphNodeModulePath
func (*NodeAbstractProvider) Name ¶
func (n *NodeAbstractProvider) Name() string
func (*NodeAbstractProvider) Path ¶
func (n *NodeAbstractProvider) Path() addrs.ModuleInstance
GraphNodeModuleInstance
func (*NodeAbstractProvider) ProviderAddr ¶
func (n *NodeAbstractProvider) ProviderAddr() addrs.AbsProviderConfig
GraphNodeProvider
func (*NodeAbstractProvider) ProviderConfig ¶
func (n *NodeAbstractProvider) ProviderConfig() *configs.Provider
GraphNodeProvider
func (*NodeAbstractProvider) References ¶
func (n *NodeAbstractProvider) References() []*addrs.Reference
GraphNodeReferencer
type NodeAbstractResource ¶
type NodeAbstractResource struct { Addr addrs.ConfigResource Schema *configschema.Block // Schema for processing the configuration body SchemaVersion uint64 // Schema version of "Schema", as decided by the provider Config *configs.Resource // Config is the resource in the config // ProviderMetas is the provider_meta configs for the module this resource belongs to ProviderMetas map[addrs.Provider]*configs.ProviderMeta ProvisionerSchemas map[string]*configschema.Block // Set from GraphNodeTargetable Targets []addrs.Targetable // The address of the provider this resource will use ResolvedProvider addrs.AbsProviderConfig // contains filtered or unexported fields }
NodeAbstractResource represents a resource that has no associated operations. It registers all the interfaces for a resource that common across multiple operation types.
func NewNodeAbstractResource ¶
func NewNodeAbstractResource(addr addrs.ConfigResource) *NodeAbstractResource
NewNodeAbstractResource creates an abstract resource graph node for the given absolute resource address.
func (*NodeAbstractResource) AttachDataResourceDependsOn ¶
func (n *NodeAbstractResource) AttachDataResourceDependsOn(deps []addrs.ConfigResource, force bool)
graphNodeAttachDataResourceDependsOn
func (*NodeAbstractResource) AttachProviderMetaConfigs ¶
func (n *NodeAbstractResource) AttachProviderMetaConfigs(c map[addrs.Provider]*configs.ProviderMeta)
GraphNodeAttachProviderMetaConfigs impl
func (*NodeAbstractResource) AttachProvisionerSchema ¶
func (n *NodeAbstractResource) AttachProvisionerSchema(name string, schema *configschema.Block)
GraphNodeProvisionerConsumer
func (*NodeAbstractResource) AttachResourceConfig ¶
func (n *NodeAbstractResource) AttachResourceConfig(c *configs.Resource)
GraphNodeAttachResourceConfig
func (*NodeAbstractResource) AttachResourceSchema ¶
func (n *NodeAbstractResource) AttachResourceSchema(schema *configschema.Block, version uint64)
GraphNodeAttachResourceSchema impl
func (*NodeAbstractResource) DependsOn ¶
func (n *NodeAbstractResource) DependsOn() []*addrs.Reference
func (*NodeAbstractResource) ModulePath ¶
func (n *NodeAbstractResource) ModulePath() addrs.Module
GraphNodeModulePath
func (*NodeAbstractResource) Name ¶
func (n *NodeAbstractResource) Name() string
func (*NodeAbstractResource) ProvidedBy ¶
func (n *NodeAbstractResource) ProvidedBy() (addrs.ProviderConfig, bool)
GraphNodeProviderConsumer
func (*NodeAbstractResource) Provider ¶
func (n *NodeAbstractResource) Provider() addrs.Provider
GraphNodeProviderConsumer
func (*NodeAbstractResource) ProvisionedBy ¶
func (n *NodeAbstractResource) ProvisionedBy() []string
GraphNodeProvisionerConsumer
func (*NodeAbstractResource) ReferenceableAddrs ¶
func (n *NodeAbstractResource) ReferenceableAddrs() []addrs.Referenceable
GraphNodeReferenceable
func (*NodeAbstractResource) References ¶
func (n *NodeAbstractResource) References() []*addrs.Reference
GraphNodeReferencer
func (*NodeAbstractResource) ResourceAddr ¶
func (n *NodeAbstractResource) ResourceAddr() addrs.ConfigResource
GraphNodeResource
func (*NodeAbstractResource) SetProvider ¶
func (n *NodeAbstractResource) SetProvider(p addrs.AbsProviderConfig)
func (*NodeAbstractResource) SetTargets ¶
func (n *NodeAbstractResource) SetTargets(targets []addrs.Targetable)
GraphNodeTargetable
type NodeAbstractResourceInstance ¶
type NodeAbstractResourceInstance struct { NodeAbstractResource Addr addrs.AbsResourceInstance Dependencies []addrs.ConfigResource // contains filtered or unexported fields }
NodeAbstractResourceInstance represents a resource instance with no associated operations. It embeds NodeAbstractResource but additionally contains an instance key, used to identify one of potentially many instances that were created from a resource in configuration, e.g. using the "count" or "for_each" arguments.
func NewNodeAbstractResourceInstance ¶
func NewNodeAbstractResourceInstance(addr addrs.AbsResourceInstance) *NodeAbstractResourceInstance
NewNodeAbstractResourceInstance creates an abstract resource instance graph node for the given absolute resource instance address.
func (*NodeAbstractResourceInstance) AttachResourceState ¶
func (n *NodeAbstractResourceInstance) AttachResourceState(s *states.Resource)
GraphNodeAttachResourceState
func (*NodeAbstractResourceInstance) Name ¶
func (n *NodeAbstractResourceInstance) Name() string
func (*NodeAbstractResourceInstance) Path ¶
func (n *NodeAbstractResourceInstance) Path() addrs.ModuleInstance
func (*NodeAbstractResourceInstance) ReferenceableAddrs ¶
func (n *NodeAbstractResourceInstance) ReferenceableAddrs() []addrs.Referenceable
GraphNodeReferenceable
func (*NodeAbstractResourceInstance) References ¶
func (n *NodeAbstractResourceInstance) References() []*addrs.Reference
GraphNodeReferencer
func (*NodeAbstractResourceInstance) ResourceInstanceAddr ¶
func (n *NodeAbstractResourceInstance) ResourceInstanceAddr() addrs.AbsResourceInstance
GraphNodeResourceInstance
func (*NodeAbstractResourceInstance) StateDependencies ¶
func (n *NodeAbstractResourceInstance) StateDependencies() []addrs.ConfigResource
StateDependencies returns the dependencies which will be saved in the state for managed resources, or the most current dependencies for data resources.
type NodeApplyableOutput ¶
type NodeApplyableOutput struct { Addr addrs.AbsOutputValue Config *configs.Output // Config is the output in the config // If this is being evaluated during apply, we may have a change recorded already Change *plans.OutputChangeSrc // Refresh-only mode means that any failing output preconditions are // reported as warnings rather than errors RefreshOnly bool // DestroyApply indicates that we are applying a destroy plan, and do not // need to account for conditional blocks. DestroyApply bool Planning bool }
NodeApplyableOutput represents an output that is "applyable": it is ready to be applied.
func (*NodeApplyableOutput) Execute ¶
func (n *NodeApplyableOutput) Execute(ctx EvalContext, op walkOperation) (diags tfdiags.Diagnostics)
GraphNodeExecutable
func (*NodeApplyableOutput) ModulePath ¶
func (n *NodeApplyableOutput) ModulePath() addrs.Module
GraphNodeModulePath
func (*NodeApplyableOutput) Name ¶
func (n *NodeApplyableOutput) Name() string
func (*NodeApplyableOutput) Path ¶
func (n *NodeApplyableOutput) Path() addrs.ModuleInstance
GraphNodeModuleInstance
func (*NodeApplyableOutput) ReferenceOutside ¶
func (n *NodeApplyableOutput) ReferenceOutside() (selfPath, referencePath addrs.Module)
GraphNodeReferenceOutside implementation
func (*NodeApplyableOutput) ReferenceableAddrs ¶
func (n *NodeApplyableOutput) ReferenceableAddrs() []addrs.Referenceable
GraphNodeReferenceable
func (*NodeApplyableOutput) References ¶
func (n *NodeApplyableOutput) References() []*addrs.Reference
GraphNodeReferencer
type NodeApplyableProvider ¶
type NodeApplyableProvider struct {
*NodeAbstractProvider
}
NodeApplyableProvider represents a provider during an apply.
func (*NodeApplyableProvider) ConfigureProvider ¶
func (n *NodeApplyableProvider) ConfigureProvider(ctx EvalContext, provider providers.Interface, verifyConfigIsKnown bool) (diags tfdiags.Diagnostics)
ConfigureProvider configures a provider that is already initialized and retrieved. If verifyConfigIsKnown is true, ConfigureProvider will return an error if the provider configVal is not wholly known and is meant only for use during import.
func (*NodeApplyableProvider) Execute ¶
func (n *NodeApplyableProvider) Execute(ctx EvalContext, op walkOperation) (diags tfdiags.Diagnostics)
GraphNodeExecutable
func (*NodeApplyableProvider) ValidateProvider ¶
func (n *NodeApplyableProvider) ValidateProvider(ctx EvalContext, provider providers.Interface) (diags tfdiags.Diagnostics)
type NodeApplyableResourceInstance ¶
type NodeApplyableResourceInstance struct { *NodeAbstractResourceInstance // If this node is forced to be CreateBeforeDestroy, we need to record that // in the state to. ForceCreateBeforeDestroy bool // contains filtered or unexported fields }
NodeApplyableResourceInstance represents a resource instance that is "applyable": it is ready to be applied and is represented by a diff.
This node is for a specific instance of a resource. It will usually be accompanied in the graph by a NodeApplyableResource representing its containing resource, and should depend on that node to ensure that the state is properly prepared to receive changes to instances.
func (*NodeApplyableResourceInstance) AttachDependencies ¶
func (n *NodeApplyableResourceInstance) AttachDependencies(deps []addrs.ConfigResource)
GraphNodeAttachDependencies
func (*NodeApplyableResourceInstance) CreateAddr ¶
func (n *NodeApplyableResourceInstance) CreateAddr() *addrs.AbsResourceInstance
GraphNodeCreator
func (*NodeApplyableResourceInstance) CreateBeforeDestroy ¶
func (n *NodeApplyableResourceInstance) CreateBeforeDestroy() bool
CreateBeforeDestroy returns this node's CreateBeforeDestroy status.
func (*NodeApplyableResourceInstance) Execute ¶
func (n *NodeApplyableResourceInstance) Execute(ctx EvalContext, op walkOperation) (diags tfdiags.Diagnostics)
GraphNodeExecutable
func (*NodeApplyableResourceInstance) ModifyCreateBeforeDestroy ¶
func (n *NodeApplyableResourceInstance) ModifyCreateBeforeDestroy(v bool) error
func (*NodeApplyableResourceInstance) References ¶
func (n *NodeApplyableResourceInstance) References() []*addrs.Reference
GraphNodeReferencer, overriding NodeAbstractResourceInstance
func (*NodeApplyableResourceInstance) SetPreallocatedDeposedKey ¶
func (n *NodeApplyableResourceInstance) SetPreallocatedDeposedKey(key states.DeposedKey)
type NodeDestroyDeposedResourceInstanceObject ¶
type NodeDestroyDeposedResourceInstanceObject struct { *NodeAbstractResourceInstance DeposedKey states.DeposedKey }
NodeDestroyDeposedResourceInstanceObject represents deposed resource instance objects during apply. Nodes of this type are inserted by DiffTransformer when the planned changeset contains "delete" changes for deposed instance objects, and its only supported operation is to destroy and then forget the associated object.
func (*NodeDestroyDeposedResourceInstanceObject) CreateBeforeDestroy ¶
func (n *NodeDestroyDeposedResourceInstanceObject) CreateBeforeDestroy() bool
GraphNodeDestroyerCBD
func (*NodeDestroyDeposedResourceInstanceObject) DeposedInstanceObjectKey ¶
func (n *NodeDestroyDeposedResourceInstanceObject) DeposedInstanceObjectKey() states.DeposedKey
func (*NodeDestroyDeposedResourceInstanceObject) DestroyAddr ¶
func (n *NodeDestroyDeposedResourceInstanceObject) DestroyAddr() *addrs.AbsResourceInstance
GraphNodeDestroyer
func (*NodeDestroyDeposedResourceInstanceObject) Execute ¶
func (n *NodeDestroyDeposedResourceInstanceObject) Execute(ctx EvalContext, op walkOperation) (diags tfdiags.Diagnostics)
GraphNodeExecutable impl.
func (*NodeDestroyDeposedResourceInstanceObject) ModifyCreateBeforeDestroy ¶
func (n *NodeDestroyDeposedResourceInstanceObject) ModifyCreateBeforeDestroy(v bool) error
GraphNodeDestroyerCBD
func (*NodeDestroyDeposedResourceInstanceObject) Name ¶
func (n *NodeDestroyDeposedResourceInstanceObject) Name() string
func (*NodeDestroyDeposedResourceInstanceObject) ReferenceableAddrs ¶
func (n *NodeDestroyDeposedResourceInstanceObject) ReferenceableAddrs() []addrs.Referenceable
GraphNodeReferenceable implementation, overriding the one from NodeAbstractResourceInstance
func (*NodeDestroyDeposedResourceInstanceObject) References ¶
func (n *NodeDestroyDeposedResourceInstanceObject) References() []*addrs.Reference
GraphNodeReferencer implementation, overriding the one from NodeAbstractResourceInstance
type NodeDestroyResourceInstance ¶
type NodeDestroyResourceInstance struct { *NodeAbstractResourceInstance // If DeposedKey is set to anything other than states.NotDeposed then // this node destroys a deposed object of the associated instance // rather than its current object. DeposedKey states.DeposedKey }
NodeDestroyResourceInstance represents a resource instance that is to be destroyed.
func (*NodeDestroyResourceInstance) CreateBeforeDestroy ¶
func (n *NodeDestroyResourceInstance) CreateBeforeDestroy() bool
GraphNodeDestroyerCBD
func (*NodeDestroyResourceInstance) DestroyAddr ¶
func (n *NodeDestroyResourceInstance) DestroyAddr() *addrs.AbsResourceInstance
GraphNodeDestroyer
func (*NodeDestroyResourceInstance) Execute ¶
func (n *NodeDestroyResourceInstance) Execute(ctx EvalContext, op walkOperation) (diags tfdiags.Diagnostics)
GraphNodeExecutable
func (*NodeDestroyResourceInstance) ModifyCreateBeforeDestroy ¶
func (n *NodeDestroyResourceInstance) ModifyCreateBeforeDestroy(v bool) error
GraphNodeDestroyerCBD
func (*NodeDestroyResourceInstance) Name ¶
func (n *NodeDestroyResourceInstance) Name() string
func (*NodeDestroyResourceInstance) ProvidedBy ¶
func (n *NodeDestroyResourceInstance) ProvidedBy() (addr addrs.ProviderConfig, exact bool)
func (*NodeDestroyResourceInstance) ReferenceableAddrs ¶
func (n *NodeDestroyResourceInstance) ReferenceableAddrs() []addrs.Referenceable
GraphNodeReferenceable, overriding NodeAbstractResource
func (*NodeDestroyResourceInstance) References ¶
func (n *NodeDestroyResourceInstance) References() []*addrs.Reference
GraphNodeReferencer, overriding NodeAbstractResource
type NodeDestroyableDataResourceInstance ¶
type NodeDestroyableDataResourceInstance struct {
*NodeAbstractResourceInstance
}
NodeDestroyableDataResourceInstance represents a resource that is "destroyable": it is ready to be destroyed.
func (*NodeDestroyableDataResourceInstance) Execute ¶
func (n *NodeDestroyableDataResourceInstance) Execute(ctx EvalContext, op walkOperation) tfdiags.Diagnostics
GraphNodeExecutable
type NodeDestroyableOutput ¶
type NodeDestroyableOutput struct { Addr addrs.AbsOutputValue Planning bool }
NodeDestroyableOutput represents an output that is "destroyable": its application will remove the output from the state.
func (*NodeDestroyableOutput) Execute ¶
func (n *NodeDestroyableOutput) Execute(ctx EvalContext, op walkOperation) tfdiags.Diagnostics
GraphNodeExecutable
func (*NodeDestroyableOutput) ModulePath ¶
func (n *NodeDestroyableOutput) ModulePath() addrs.Module
GraphNodeModulePath
func (*NodeDestroyableOutput) Name ¶
func (n *NodeDestroyableOutput) Name() string
type NodeEvalableProvider ¶
type NodeEvalableProvider struct {
*NodeAbstractProvider
}
NodeEvalableProvider represents a provider during an "eval" walk. This special provider node type just initializes a provider and fetches its schema, without configuring it or otherwise interacting with it.
func (*NodeEvalableProvider) Execute ¶
func (n *NodeEvalableProvider) Execute(ctx EvalContext, op walkOperation) (diags tfdiags.Diagnostics)
GraphNodeExecutable
type NodeLocal ¶
type NodeLocal struct { Addr addrs.AbsLocalValue Config *configs.Local }
NodeLocal represents a named local value in a particular module.
Local value nodes only have one operation, common to all walk types: evaluate the result and place it in state.
func (*NodeLocal) Execute ¶
func (n *NodeLocal) Execute(ctx EvalContext, op walkOperation) (diags tfdiags.Diagnostics)
GraphNodeExecutable NodeLocal.Execute is an Execute implementation that evaluates the expression for a local value and writes it into a transient part of the state.
func (*NodeLocal) ReferenceableAddrs ¶
func (n *NodeLocal) ReferenceableAddrs() []addrs.Referenceable
GraphNodeReferenceable
func (*NodeLocal) References ¶
GraphNodeReferencer
type NodePlanDeposedResourceInstanceObject ¶
type NodePlanDeposedResourceInstanceObject struct { *NodeAbstractResourceInstance DeposedKey states.DeposedKey // contains filtered or unexported fields }
NodePlanDeposedResourceInstanceObject represents deposed resource instance objects during plan. These are distinct from the primary object for each resource instance since the only valid operation to do with them is to destroy them.
This node type is also used during the refresh walk to ensure that the record of a deposed object is up-to-date before we plan to destroy it.
func (*NodePlanDeposedResourceInstanceObject) DeposedInstanceObjectKey ¶
func (n *NodePlanDeposedResourceInstanceObject) DeposedInstanceObjectKey() states.DeposedKey
func (*NodePlanDeposedResourceInstanceObject) Execute ¶
func (n *NodePlanDeposedResourceInstanceObject) Execute(ctx EvalContext, op walkOperation) (diags tfdiags.Diagnostics)
GraphNodeEvalable impl.
func (*NodePlanDeposedResourceInstanceObject) Name ¶
func (n *NodePlanDeposedResourceInstanceObject) Name() string
func (*NodePlanDeposedResourceInstanceObject) ReferenceableAddrs ¶
func (n *NodePlanDeposedResourceInstanceObject) ReferenceableAddrs() []addrs.Referenceable
GraphNodeReferenceable implementation, overriding the one from NodeAbstractResourceInstance
func (*NodePlanDeposedResourceInstanceObject) References ¶
func (n *NodePlanDeposedResourceInstanceObject) References() []*addrs.Reference
GraphNodeReferencer implementation, overriding the one from NodeAbstractResourceInstance
type NodePlanDestroyableResourceInstance ¶
type NodePlanDestroyableResourceInstance struct { *NodeAbstractResourceInstance // contains filtered or unexported fields }
NodePlanDestroyableResourceInstance represents a resource that is ready to be planned for destruction.
func (*NodePlanDestroyableResourceInstance) DestroyAddr ¶
func (n *NodePlanDestroyableResourceInstance) DestroyAddr() *addrs.AbsResourceInstance
GraphNodeDestroyer
func (*NodePlanDestroyableResourceInstance) Execute ¶
func (n *NodePlanDestroyableResourceInstance) Execute(ctx EvalContext, op walkOperation) (diags tfdiags.Diagnostics)
GraphNodeEvalable
type NodePlannableResourceInstance ¶
type NodePlannableResourceInstance struct { *NodeAbstractResourceInstance ForceCreateBeforeDestroy bool // contains filtered or unexported fields }
NodePlannableResourceInstance represents a _single_ resource instance that is plannable. This means this represents a single count index, for example.
func (*NodePlannableResourceInstance) Execute ¶
func (n *NodePlannableResourceInstance) Execute(ctx EvalContext, op walkOperation) tfdiags.Diagnostics
GraphNodeEvalable
type NodePlannableResourceInstanceOrphan ¶
type NodePlannableResourceInstanceOrphan struct { *NodeAbstractResourceInstance // contains filtered or unexported fields }
NodePlannableResourceInstanceOrphan represents a resource that is "applyable": it is ready to be applied and is represented by a diff.
func (*NodePlannableResourceInstanceOrphan) Execute ¶
func (n *NodePlannableResourceInstanceOrphan) Execute(ctx EvalContext, op walkOperation) tfdiags.Diagnostics
GraphNodeExecutable
func (*NodePlannableResourceInstanceOrphan) Name ¶
func (n *NodePlannableResourceInstanceOrphan) Name() string
func (*NodePlannableResourceInstanceOrphan) ProvidedBy ¶
func (n *NodePlannableResourceInstanceOrphan) ProvidedBy() (addr addrs.ProviderConfig, exact bool)
type NodeRootVariable ¶
type NodeRootVariable struct { Addr addrs.InputVariable Config *configs.Variable // RawValue is the value for the variable set from outside OpenTofu // Core, such as on the command line, or from an environment variable, // or similar. This is the raw value that was provided, not yet // converted or validated, and can be nil for a variable that isn't // set at all. RawValue *InputValue }
NodeRootVariable represents a root variable input.
func (*NodeRootVariable) Execute ¶
func (n *NodeRootVariable) Execute(ctx EvalContext, op walkOperation) tfdiags.Diagnostics
GraphNodeExecutable
func (*NodeRootVariable) ModulePath ¶
func (n *NodeRootVariable) ModulePath() addrs.Module
func (*NodeRootVariable) Name ¶
func (n *NodeRootVariable) Name() string
func (*NodeRootVariable) Path ¶
func (n *NodeRootVariable) Path() addrs.ModuleInstance
GraphNodeModuleInstance
func (*NodeRootVariable) ReferenceableAddrs ¶
func (n *NodeRootVariable) ReferenceableAddrs() []addrs.Referenceable
GraphNodeReferenceable
type NodeValidatableResource ¶
type NodeValidatableResource struct {
*NodeAbstractResource
}
NodeValidatableResource represents a resource that is used for validation only.
func (*NodeValidatableResource) Execute ¶
func (n *NodeValidatableResource) Execute(ctx EvalContext, op walkOperation) (diags tfdiags.Diagnostics)
GraphNodeEvalable
func (*NodeValidatableResource) Path ¶
func (n *NodeValidatableResource) Path() addrs.ModuleInstance
type NullGraphWalker ¶
type NullGraphWalker struct{}
NullGraphWalker is a GraphWalker implementation that does nothing. This can be embedded within other GraphWalker implementations for easily implementing all the required functions.
func (NullGraphWalker) EnterPath ¶
func (NullGraphWalker) EnterPath(addrs.ModuleInstance) EvalContext
func (NullGraphWalker) EvalContext ¶
func (NullGraphWalker) EvalContext() EvalContext
func (NullGraphWalker) Execute ¶
func (NullGraphWalker) Execute(EvalContext, GraphNodeExecutable) tfdiags.Diagnostics
func (NullGraphWalker) ExitPath ¶
func (NullGraphWalker) ExitPath(addrs.ModuleInstance)
type OrphanOutputTransformer ¶
type OrphanOutputTransformer struct { Config *configs.Config // Root of config tree State *states.State // State is the root state Planning bool }
OrphanOutputTransformer finds the outputs that aren't present in the given config that are in the state and adds them to the graph for deletion.
func (*OrphanOutputTransformer) Transform ¶
func (t *OrphanOutputTransformer) Transform(g *Graph) error
type OrphanResourceInstanceCountTransformer ¶
type OrphanResourceInstanceCountTransformer struct { Concrete ConcreteResourceInstanceNodeFunc Addr addrs.AbsResource // Addr of the resource to look for orphans InstanceAddrs []addrs.AbsResourceInstance // Addresses that currently exist in config State *states.State // Full global state }
OrphanResourceInstanceCountTransformer is a GraphTransformer that adds orphans for an expanded count to the graph. The determination of this depends on the count argument given.
Orphans are found by comparing the count to what is found in the state. This transform assumes that if an element in the state is within the count bounds given, that it is not an orphan.
func (*OrphanResourceInstanceCountTransformer) Transform ¶
func (t *OrphanResourceInstanceCountTransformer) Transform(g *Graph) error
type OrphanResourceInstanceTransformer ¶
type OrphanResourceInstanceTransformer struct { Concrete ConcreteResourceInstanceNodeFunc // State is the global state. We require the global state to // properly find module orphans at our path. State *states.State // Config is the root node in the configuration tree. We'll look up // the appropriate note in this tree using the path in each node. Config *configs.Config // contains filtered or unexported fields }
OrphanResourceInstanceTransformer is a GraphTransformer that adds orphaned resource instances to the graph. An "orphan" is an instance that is present in the state but belongs to a resource that is no longer present in the configuration.
This is not the transformer that deals with "count orphans" (instances that are no longer covered by a resource's "count" or "for_each" setting); that's handled instead by OrphanResourceCountTransformer.
func (*OrphanResourceInstanceTransformer) Transform ¶
func (t *OrphanResourceInstanceTransformer) Transform(g *Graph) error
type OutputTransformer ¶
type OutputTransformer struct { Config *configs.Config // Refresh-only mode means that any failing output preconditions are // reported as warnings rather than errors RefreshOnly bool // Planning must be set to true only when we're building a planning graph. // It must be set to false whenever we're building an apply graph. Planning bool // If this is a planned destroy, root outputs are still in the configuration // so we need to record that we wish to remove them. Destroying bool }
OutputTransformer is a GraphTransformer that adds all the outputs in the configuration to the graph.
This is done for the apply graph builder even if dependent nodes aren't changing since there is no downside: the state will be available even if the dependent items aren't changing.
func (*OutputTransformer) Transform ¶
func (t *OutputTransformer) Transform(g *Graph) error
type PlanGraphBuilder ¶
type PlanGraphBuilder struct { // Config is the configuration tree to build a plan from. Config *configs.Config // State is the current state State *states.State // RootVariableValues are the raw input values for root input variables // given by the caller, which we'll resolve into final values as part // of the plan walk. RootVariableValues InputValues // Plugins is a library of plug-in components (providers and // provisioners) available for use. Plugins *contextPlugins // Targets are resources to target Targets []addrs.Targetable // ForceReplace are resource instances where if we would normally have // generated a NoOp or Update action then we'll force generating a replace // action instead. Create and Delete actions are not affected. ForceReplace []addrs.AbsResourceInstance ConcreteProvider ConcreteProviderNodeFunc ConcreteResource ConcreteResourceNodeFunc ConcreteResourceInstance ConcreteResourceInstanceNodeFunc ConcreteResourceOrphan ConcreteResourceInstanceNodeFunc ConcreteResourceInstanceDeposed ConcreteResourceInstanceDeposedNodeFunc ConcreteModule ConcreteModuleNodeFunc // Plan Operation this graph will be used for. Operation walkOperation // ExternalReferences allows the external caller to pass in references to // nodes that should not be pruned even if they are not referenced within // the actual graph. ExternalReferences []*addrs.Reference // ImportTargets are the list of resources to import. ImportTargets []*ImportTarget // GenerateConfig tells OpenTofu where to write and generated config for // any import targets that do not already have configuration. // // If empty, then config will not be generated. GenerateConfigPath string // contains filtered or unexported fields }
PlanGraphBuilder is a GraphBuilder implementation that builds a graph for planning and for other "plan-like" operations which don't require an already-calculated plan as input.
Unlike the apply graph builder, this graph builder:
Makes its decisions primarily based on the given configuration, which represents the desired state.
Ignores certain lifecycle concerns like create_before_destroy, because those are only important once we already know what action we're planning to take against a particular resource instance.
func (*PlanGraphBuilder) Build ¶
func (b *PlanGraphBuilder) Build(path addrs.ModuleInstance) (*Graph, tfdiags.Diagnostics)
See GraphBuilder
func (*PlanGraphBuilder) Steps ¶
func (b *PlanGraphBuilder) Steps() []GraphTransformer
See GraphBuilder
type PlanOpts ¶
type PlanOpts struct { // Mode defines what variety of plan the caller wishes to create. // Refer to the documentation of the plans.Mode type and its values // for more information. Mode plans.Mode // SkipRefresh specifies to trust that the current values for managed // resource instances in the prior state are accurate and to therefore // disable the usual step of fetching updated values for each resource // instance using its corresponding provider. SkipRefresh bool // PreDestroyRefresh indicated that this is being passed to a plan used to // refresh the state immediately before a destroy plan. // FIXME: This is a temporary fix to allow the pre-destroy refresh to // succeed. The refreshing operation during destroy must be a special case, // which can allow for missing instances in the state, and avoid blocking // on failing condition tests. The destroy plan itself should be // responsible for this special case of refreshing, and the separate // pre-destroy plan removed entirely. PreDestroyRefresh bool // SetVariables are the raw values for root module variables as provided // by the user who is requesting the run, prior to any normalization or // substitution of defaults. See the documentation for the InputValue // type for more information on how to correctly populate this. SetVariables InputValues // If Targets has a non-zero length then it activates targeted planning // mode, where OpenTofu will take actions only for resource instances // mentioned in this set and any other objects those resource instances // depend on. // // Targeted planning mode is intended for exceptional use only, // and so populating this field will cause OpenTofu to generate extra // warnings as part of the planning result. Targets []addrs.Targetable // ForceReplace is a set of resource instance addresses whose corresponding // objects should be forced planned for replacement if the provider's // plan would otherwise have been to either update the object in-place or // to take no action on it at all. // // A typical use of this argument is to ask OpenTofu to replace an object // which the user has determined is somehow degraded (via information from // outside of OpenTofu), thereby hopefully replacing it with a // fully-functional new object. ForceReplace []addrs.AbsResourceInstance // ExternalReferences allows the external caller to pass in references to // nodes that should not be pruned even if they are not referenced within // the actual graph. ExternalReferences []*addrs.Reference // ImportTargets is a list of target resources to import. These resources // will be added to the plan graph. ImportTargets []*ImportTarget // GenerateConfig tells OpenTofu where to write any generated configuration // for any ImportTargets that do not have configuration already. // // If empty, then no config will be generated. GenerateConfigPath string }
PlanOpts are the various options that affect the details of how OpenTofu will build a plan.
func SimplePlanOpts ¶
func SimplePlanOpts(mode plans.Mode, setVariables InputValues) *PlanOpts
SimplePlanOpts is a constructor to help with creating "simple" values of PlanOpts which only specify a mode and input variables.
This helper function is primarily intended for use in straightforward tests that don't need any of the more "esoteric" planning options. For handling real user requests to run OpenTofu, it'd probably be better to construct a *PlanOpts value directly and provide a way for the user to set values for all of its fields.
The "mode" and "setVariables" arguments become the values of the "Mode" and "SetVariables" fields in the result. Refer to the PlanOpts type documentation to learn about the meanings of those fields.
type PrefixUIInput ¶
PrefixUIInput is an implementation of UIInput that prefixes the ID with a string, allowing queries to be namespaced.
type ProviderConfigTransformer ¶
type ProviderConfigTransformer struct { Concrete ConcreteProviderNodeFunc // Config is the root node of the configuration tree to add providers from. Config *configs.Config // contains filtered or unexported fields }
ProviderConfigTransformer adds all provider nodes from the configuration and attaches the configs.
func (*ProviderConfigTransformer) Transform ¶
func (t *ProviderConfigTransformer) Transform(g *Graph) error
type ProviderTransformer ¶
ProviderTransformer is a GraphTransformer that maps resources to providers within the graph. This will error if there are any resources that don't map to proper resources.
func (*ProviderTransformer) Transform ¶
func (t *ProviderTransformer) Transform(g *Graph) error
type ProvisionerUIOutput ¶
type ProvisionerUIOutput struct { InstanceAddr addrs.AbsResourceInstance ProvisionerType string Hooks []Hook }
ProvisionerUIOutput is an implementation of UIOutput that calls a hook for the output so that the hooks can handle it.
func (*ProvisionerUIOutput) Output ¶
func (o *ProvisionerUIOutput) Output(msg string)
type PruneProviderTransformer ¶
type PruneProviderTransformer struct{}
PruneProviderTransformer removes any providers that are not actually used by anything, and provider proxies. This avoids the provider being initialized and configured. This both saves resources but also avoids errors since configuration may imply initialization which may require auth.
func (*PruneProviderTransformer) Transform ¶
func (t *PruneProviderTransformer) Transform(g *Graph) error
type ReferenceMap ¶
ReferenceMap is a structure that can be used to efficiently check for references on a graph, mapping internal reference keys (as produced by the mapKey method) to one or more vertices that are identified by each key.
func NewReferenceMap ¶
func NewReferenceMap(vs []dag.Vertex) ReferenceMap
NewReferenceMap is used to create a new reference map for the given set of vertices.
func (ReferenceMap) References ¶
func (m ReferenceMap) References(v dag.Vertex) []dag.Vertex
References returns the set of vertices that the given vertex refers to, and any referenced addresses that do not have corresponding vertices.
type ReferenceTransformer ¶
type ReferenceTransformer struct{}
ReferenceTransformer is a GraphTransformer that connects all the nodes that reference each other in order to form the proper ordering.
func (*ReferenceTransformer) Transform ¶
func (t *ReferenceTransformer) Transform(g *Graph) error
type RemovedModuleTransformer ¶
type RemovedModuleTransformer struct { Config *configs.Config // root node in the config tree State *states.State }
RemovedModuleTransformer implements GraphTransformer to add nodes indicating when a module was removed from the configuration.
func (*RemovedModuleTransformer) Transform ¶
func (t *RemovedModuleTransformer) Transform(g *Graph) error
type ResourceCountTransformer ¶
type ResourceCountTransformer struct { Concrete ConcreteResourceInstanceNodeFunc Schema *configschema.Block Addr addrs.ConfigResource InstanceAddrs []addrs.AbsResourceInstance }
ResourceCountTransformer is a GraphTransformer that expands the count out for a specific resource.
This assumes that the count is already interpolated.
func (*ResourceCountTransformer) Transform ¶
func (t *ResourceCountTransformer) Transform(g *Graph) error
type RootTransformer ¶
type RootTransformer struct{}
RootTransformer is a GraphTransformer that adds a root to the graph.
func (*RootTransformer) Transform ¶
func (t *RootTransformer) Transform(g *Graph) error
type RootVariableTransformer ¶
type RootVariableTransformer struct { Config *configs.Config RawValues InputValues }
RootVariableTransformer is a GraphTransformer that adds all the root variables to the graph.
Root variables are currently no-ops but they must be added to the graph since downstream things that depend on them must be able to reach them.
func (*RootVariableTransformer) Transform ¶
func (t *RootVariableTransformer) Transform(g *Graph) error
type Schemas ¶
type Schemas struct { Providers map[addrs.Provider]providers.ProviderSchema Provisioners map[string]*configschema.Block }
Schemas is a container for various kinds of schema that OpenTofu needs during processing.
func (*Schemas) ProviderConfig ¶
func (ss *Schemas) ProviderConfig(provider addrs.Provider) *configschema.Block
ProviderConfig returns the schema for the provider configuration of the given provider type, or nil if no such schema is available.
func (*Schemas) ProviderSchema ¶
func (ss *Schemas) ProviderSchema(provider addrs.Provider) providers.ProviderSchema
ProviderSchema returns the entire ProviderSchema object that was produced by the plugin for the given provider, or nil if no such schema is available.
It's usually better to go use the more precise methods offered by type Schemas to handle this detail automatically.
func (*Schemas) ProvisionerConfig ¶
func (ss *Schemas) ProvisionerConfig(name string) *configschema.Block
ProvisionerConfig returns the schema for the configuration of a given provisioner, or nil of no such schema is available.
func (*Schemas) ResourceTypeConfig ¶
func (ss *Schemas) ResourceTypeConfig(provider addrs.Provider, resourceMode addrs.ResourceMode, resourceType string) (block *configschema.Block, schemaVersion uint64)
ResourceTypeConfig returns the schema for the configuration of a given resource type belonging to a given provider type, or nil of no such schema is available.
In many cases the provider type is inferrable from the resource type name, but this is not always true because users can override the provider for a resource using the "provider" meta-argument. Therefore it's important to always pass the correct provider name, even though it many cases it feels redundant.
type Semaphore ¶
type Semaphore chan struct{}
Semaphore is a wrapper around a channel to provide utility methods to clarify that we are treating the channel as a semaphore
func NewSemaphore ¶
NewSemaphore creates a semaphore that allows up to a given limit of simultaneous acquisitions
func (Semaphore) Acquire ¶
func (s Semaphore) Acquire()
Acquire is used to acquire an available slot. Blocks until available.
func (Semaphore) Release ¶
func (s Semaphore) Release()
Release is used to return a slot. Acquire must be called as a pre-condition.
func (Semaphore) TryAcquire ¶
TryAcquire is used to do a non-blocking acquire. Returns a bool indicating success
type StateTransformer ¶
type StateTransformer struct { // ConcreteCurrent and ConcreteDeposed are used to specialize the abstract // resource instance nodes that this transformer will create. // // If either of these is nil, the objects of that type will be skipped and // not added to the graph at all. It doesn't make sense to use this // transformer without setting at least one of these, since that would // skip everything and thus be a no-op. ConcreteCurrent ConcreteResourceInstanceNodeFunc ConcreteDeposed ConcreteResourceInstanceDeposedNodeFunc State *states.State }
StateTransformer is a GraphTransformer that adds the elements of the state to the graph.
This transform is used for example by the DestroyPlanGraphBuilder to ensure that only resources that are in the state are represented in the graph.
func (*StateTransformer) Transform ¶
func (t *StateTransformer) Transform(g *Graph) error
type TargetsTransformer ¶
type TargetsTransformer struct { // List of targeted resource names specified by the user Targets []addrs.Targetable }
TargetsTransformer is a GraphTransformer that, when the user specifies a list of resources to target, limits the graph to only those resources and their dependencies.
func (*TargetsTransformer) Transform ¶
func (t *TargetsTransformer) Transform(g *Graph) error
type TestContext ¶
type TestContext struct { *Context Config *configs.Config State *states.State Plan *plans.Plan Variables InputValues }
TestContext wraps a Context, and adds in direct values for the current state, most recent plan, and configuration.
This combination allows functions called on the TestContext to create a complete scope to evaluate test assertions.
func (*TestContext) EvaluateAgainstPlan ¶
func (ctx *TestContext) EvaluateAgainstPlan(run *moduletest.Run)
EvaluateAgainstPlan processes the assertions inside the provided configs.TestRun against the embedded plan and state.
func (*TestContext) EvaluateAgainstState ¶
func (ctx *TestContext) EvaluateAgainstState(run *moduletest.Run)
EvaluateAgainstState processes the assertions inside the provided configs.TestRun against the embedded state.
The provided plan is import as it is needed to evaluate the `plantimestamp` function, but no data or changes from the embedded plan is referenced in this function.
type TransitiveReductionTransformer ¶
type TransitiveReductionTransformer struct{}
TransitiveReductionTransformer is a GraphTransformer that finds the transitive reduction of the graph. For a definition of transitive reduction, see [Wikipedia](https://en.wikipedia.org/wiki/Transitive_reduction).
func (*TransitiveReductionTransformer) Transform ¶
func (t *TransitiveReductionTransformer) Transform(g *Graph) error
type UIInput ¶
UIInput is the interface that must be implemented to ask for input from this user. This should forward the request to wherever the user inputs things to ask for values.
type UIOutput ¶
type UIOutput interface {
Output(string)
}
UIOutput is the interface that must be implemented to output data to the end user.
type ValueSourceType ¶
type ValueSourceType rune
ValueSourceType describes what broad category of source location provided a particular value.
const ( // ValueFromUnknown is the zero value of ValueSourceType and is not valid. ValueFromUnknown ValueSourceType = 0 // ValueFromConfig indicates that a value came from a .tf or .tf.json file, // e.g. the default value defined for a variable. ValueFromConfig ValueSourceType = 'C' // ValueFromAutoFile indicates that a value came from a "values file", like // a .tfvars file, that was implicitly loaded by naming convention. ValueFromAutoFile ValueSourceType = 'F' // ValueFromNamedFile indicates that a value came from a named "values file", // like a .tfvars file, that was passed explicitly on the command line (e.g. // -var-file=foo.tfvars). ValueFromNamedFile ValueSourceType = 'N' // ValueFromCLIArg indicates that the value was provided directly in // a CLI argument. The name of this argument is not recorded and so it must // be inferred from context. ValueFromCLIArg ValueSourceType = 'A' // ValueFromEnvVar indicates that the value was provided via an environment // variable. The name of the variable is not recorded and so it must be // inferred from context. ValueFromEnvVar ValueSourceType = 'E' // ValueFromInput indicates that the value was provided at an interactive // input prompt. ValueFromInput ValueSourceType = 'I' // ValueFromPlan indicates that the value was retrieved from a stored plan. ValueFromPlan ValueSourceType = 'P' // ValueFromCaller indicates that the value was explicitly overridden by // a caller to Context.SetVariable after the context was constructed. ValueFromCaller ValueSourceType = 'S' )
func (ValueSourceType) GoString ¶
func (v ValueSourceType) GoString() string
func (ValueSourceType) HasSourceRange ¶
func (v ValueSourceType) HasSourceRange() bool
HasSourceRange returns true if the reciever is one of the source types that is used along with a valid SourceRange field when appearing inside an InputValue object.
func (ValueSourceType) String ¶
func (i ValueSourceType) String() string
type VertexTransformer ¶
type VertexTransformer struct {
Transforms []GraphVertexTransformer
}
VertexTransformer is a GraphTransformer that transforms vertices using the GraphVertexTransformers. The Transforms are run in sequential order. If a transform replaces a vertex then the next transform will see the new vertex.
func (*VertexTransformer) Transform ¶
func (t *VertexTransformer) Transform(g *Graph) error
Notes ¶
Bugs ¶
we're not validating provider_meta blocks on EvalValidate right now because the ProviderAddr for the resource isn't available on the EvalValidate struct.
Source Files ¶
- context.go
- context_apply.go
- context_eval.go
- context_import.go
- context_input.go
- context_plan.go
- context_plugins.go
- context_refresh.go
- context_validate.go
- context_walk.go
- diagnostics.go
- eval_conditions.go
- eval_context.go
- eval_context_builtin.go
- eval_context_mock.go
- eval_count.go
- eval_for_each.go
- eval_import.go
- eval_provider.go
- eval_variable.go
- evaluate.go
- evaluate_triggers.go
- evaluate_valid.go
- execute.go
- features.go
- graph.go
- graph_builder.go
- graph_builder_apply.go
- graph_builder_eval.go
- graph_builder_plan.go
- graph_dot.go
- graph_interface_subgraph.go
- graph_walk.go
- graph_walk_context.go
- graph_walk_operation.go
- hook.go
- hook_mock.go
- hook_stop.go
- instance_expanders.go
- marks.go
- node_check.go
- node_data_destroy.go
- node_external_reference.go
- node_local.go
- node_module_expand.go
- node_module_variable.go
- node_output.go
- node_provider.go
- node_provider_abstract.go
- node_provider_eval.go
- node_resource_abstract.go
- node_resource_abstract_instance.go
- node_resource_apply.go
- node_resource_apply_instance.go
- node_resource_destroy.go
- node_resource_destroy_deposed.go
- node_resource_import.go
- node_resource_plan.go
- node_resource_plan_destroy.go
- node_resource_plan_instance.go
- node_resource_plan_orphan.go
- node_resource_validate.go
- node_root_variable.go
- node_value.go
- phasestate_string.go
- provider_mock.go
- provisioner_mock.go
- reduce_plan.go
- schemas.go
- test_context.go
- transform.go
- transform_attach_config_provider.go
- transform_attach_config_provider_meta.go
- transform_attach_config_resource.go
- transform_attach_schema.go
- transform_attach_state.go
- transform_check.go
- transform_check_starter.go
- transform_config.go
- transform_destroy_cbd.go
- transform_destroy_edge.go
- transform_diff.go
- transform_expand.go
- transform_external_reference.go
- transform_local.go
- transform_module_expansion.go
- transform_module_variable.go
- transform_orphan_count.go
- transform_orphan_output.go
- transform_orphan_resource.go
- transform_output.go
- transform_provider.go
- transform_provisioner.go
- transform_reference.go
- transform_removed_modules.go
- transform_resource_count.go
- transform_root.go
- transform_state.go
- transform_targets.go
- transform_transitive_reduction.go
- transform_variable.go
- transform_vertex.go
- ui_input.go
- ui_input_mock.go
- ui_input_prefix.go
- ui_output.go
- ui_output_callback.go
- ui_output_mock.go
- ui_output_provisioner.go
- update_state_hook.go
- upgrade_resource_state.go
- util.go
- validate_selfref.go
- valuesourcetype_string.go
- variables.go
- version_required.go
- walkoperation_string.go