thread skipContext through to the instance node
This commit is contained in:
parent
eebb4dfcb2
commit
84f7116ac8
|
@ -42,6 +42,9 @@ type PlanGraphBuilder struct {
|
|||
// Validate will do structural validation of the graph.
|
||||
Validate bool
|
||||
|
||||
// skipRefresh indicates that we should skip refreshing managed resources
|
||||
skipRefresh bool
|
||||
|
||||
// CustomConcrete can be set to customize the node types created
|
||||
// for various parts of the plan. This is useful in order to customize
|
||||
// the plan behavior.
|
||||
|
@ -196,6 +199,7 @@ func (b *PlanGraphBuilder) init() {
|
|||
b.ConcreteResource = func(a *NodeAbstractResource) dag.Vertex {
|
||||
return &nodeExpandPlannableResource{
|
||||
NodeAbstractResource: a,
|
||||
skipRefresh: b.skipRefresh,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -21,6 +21,9 @@ type nodeExpandPlannableResource struct {
|
|||
// on regardless of what the configuration says.
|
||||
ForceCreateBeforeDestroy *bool
|
||||
|
||||
// skipRefresh indicates that we should skip refreshing individual instances
|
||||
skipRefresh bool
|
||||
|
||||
// We attach dependencies to the Resource during refresh, since the
|
||||
// instances are instantiated during DynamicExpand.
|
||||
dependencies []addrs.ConfigResource
|
||||
|
@ -82,6 +85,7 @@ func (n *nodeExpandPlannableResource) DynamicExpand(ctx EvalContext) (*Graph, er
|
|||
Addr: resAddr,
|
||||
ForceCreateBeforeDestroy: n.ForceCreateBeforeDestroy,
|
||||
dependencies: n.dependencies,
|
||||
skipRefresh: n.skipRefresh,
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -144,6 +148,9 @@ type NodePlannableResource struct {
|
|||
// on regardless of what the configuration says.
|
||||
ForceCreateBeforeDestroy *bool
|
||||
|
||||
// skipRefresh indicates that we should skip refreshing individual instances
|
||||
skipRefresh bool
|
||||
|
||||
dependencies []addrs.ConfigResource
|
||||
}
|
||||
|
||||
|
@ -243,6 +250,7 @@ func (n *NodePlannableResource) DynamicExpand(ctx EvalContext) (*Graph, error) {
|
|||
// to force on CreateBeforeDestroy due to dependencies on other
|
||||
// nodes that have it.
|
||||
ForceCreateBeforeDestroy: n.CreateBeforeDestroy(),
|
||||
skipRefresh: n.skipRefresh,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -16,6 +16,7 @@ import (
|
|||
type NodePlannableResourceInstance struct {
|
||||
*NodeAbstractResourceInstance
|
||||
ForceCreateBeforeDestroy bool
|
||||
skipRefresh bool
|
||||
}
|
||||
|
||||
var (
|
||||
|
@ -134,29 +135,38 @@ func (n *NodePlannableResourceInstance) evalTreeManagedResource(addr addrs.AbsRe
|
|||
ProviderSchema: &providerSchema,
|
||||
},
|
||||
|
||||
// Refresh the instance
|
||||
&EvalReadState{
|
||||
Addr: addr.Resource,
|
||||
Provider: &provider,
|
||||
ProviderSchema: &providerSchema,
|
||||
Output: &instanceRefreshState,
|
||||
},
|
||||
&EvalRefresh{
|
||||
Addr: addr.Resource,
|
||||
ProviderAddr: n.ResolvedProvider,
|
||||
Provider: &provider,
|
||||
ProviderMetas: n.ProviderMetas,
|
||||
ProviderSchema: &providerSchema,
|
||||
State: &instanceRefreshState,
|
||||
Output: &instanceRefreshState,
|
||||
},
|
||||
&EvalWriteState{
|
||||
Addr: addr.Resource,
|
||||
ProviderAddr: n.ResolvedProvider,
|
||||
State: &instanceRefreshState,
|
||||
ProviderSchema: &providerSchema,
|
||||
targetState: refreshState,
|
||||
Dependencies: &n.Dependencies,
|
||||
&EvalIf{
|
||||
If: func(ctx EvalContext) (bool, error) {
|
||||
return !n.skipRefresh, nil
|
||||
},
|
||||
Then: &EvalSequence{
|
||||
Nodes: []EvalNode{
|
||||
// Refresh the instance
|
||||
&EvalReadState{
|
||||
Addr: addr.Resource,
|
||||
Provider: &provider,
|
||||
ProviderSchema: &providerSchema,
|
||||
Output: &instanceRefreshState,
|
||||
},
|
||||
&EvalRefresh{
|
||||
Addr: addr.Resource,
|
||||
ProviderAddr: n.ResolvedProvider,
|
||||
Provider: &provider,
|
||||
ProviderMetas: n.ProviderMetas,
|
||||
ProviderSchema: &providerSchema,
|
||||
State: &instanceRefreshState,
|
||||
Output: &instanceRefreshState,
|
||||
},
|
||||
&EvalWriteState{
|
||||
Addr: addr.Resource,
|
||||
ProviderAddr: n.ResolvedProvider,
|
||||
State: &instanceRefreshState,
|
||||
ProviderSchema: &providerSchema,
|
||||
targetState: refreshState,
|
||||
Dependencies: &n.Dependencies,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
// Plan the instance
|
||||
|
|
Loading…
Reference in New Issue