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