Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 4 additions & 8 deletions internal/terraform/node_resource_abstract_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -261,10 +261,6 @@ const (
// writeResourceInstanceState saves the given object as the current object for
// the selected resource instance.
//
// dependencies is a parameter, instead of those directly attacted to the
// NodeAbstractResourceInstance, because we don't write dependencies for
// datasources.
//
// targetState determines which context state we're writing to during plan. The
// default is the global working state.
func (n *NodeAbstractResourceInstance) writeResourceInstanceState(ctx EvalContext, obj *states.ResourceInstanceObject, targetState phaseState) error {
Expand All @@ -280,7 +276,7 @@ func (n *NodeAbstractResourceInstance) writeResourceInstanceStateDeposed(ctx Eva
return n.writeResourceInstanceStateImpl(ctx, deposedKey, obj, targetState)
}

// (this is the private common body of both writeResourceInstanceState and
// this is the private common body of both writeResourceInstanceState and
// writeResourceInstanceStateDeposed. Don't call it directly; instead, use
// one of the two wrappers to be explicit about which of the instance's
// objects you are intending to write.
Expand All @@ -290,11 +286,11 @@ func (n *NodeAbstractResourceInstance) writeResourceInstanceStateImpl(ctx EvalCo
if err != nil {
return err
}
logFuncName := "NodeAbstractResouceInstance.writeResourceInstanceState"
logFuncName := "NodeAbstractResourceInstance.writeResourceInstanceState"
if deposedKey == states.NotDeposed {
log.Printf("[TRACE] %s to %s for %s", logFuncName, targetState, absAddr)
} else {
logFuncName = "NodeAbstractResouceInstance.writeResourceInstanceStateDeposed"
logFuncName = "NodeAbstractResourceInstance.writeResourceInstanceStateDeposed"
log.Printf("[TRACE] %s to %s for %s (deposed key %s)", logFuncName, targetState, absAddr, deposedKey)
}

Expand Down Expand Up @@ -1318,7 +1314,7 @@ func (n *NodeAbstractResourceInstance) plan(
Before: priorVal,
BeforeIdentity: priorIdentity,
// Pass the marked planned value through in our change
// to propogate through evaluation.
// to propagate through evaluation.
// Marks will be removed when encoding.
After: plannedNewVal,
AfterIdentity: plannedIdentity,
Expand Down
5 changes: 0 additions & 5 deletions internal/terraform/transform_action_diff.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,8 @@ type ActionDiffTransformer struct {
}

func (t *ActionDiffTransformer) Transform(g *Graph) error {
applyNodes := addrs.MakeMap[addrs.AbsResourceInstance, *NodeApplyableResourceInstance]()
actionTriggerNodes := addrs.MakeMap[addrs.ConfigResource, []*nodeActionTriggerApplyExpand]()
for _, vs := range g.Vertices() {
if applyableResource, ok := vs.(*NodeApplyableResourceInstance); ok {
applyNodes.Put(applyableResource.Addr, applyableResource)
}

if atn, ok := vs.(*nodeActionTriggerApplyExpand); ok {
configResource := actionTriggerNodes.Get(atn.lifecycleActionTrigger.resourceAddress)
actionTriggerNodes.Put(atn.lifecycleActionTrigger.resourceAddress, append(configResource, atn))
Expand Down
5 changes: 3 additions & 2 deletions internal/terraform/transform_action_trigger_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,10 @@ func (t *ActionTriggerConfigTransformer) transformSingle(g *Graph, config *confi
containsBeforeEvent := false
containsAfterEvent := false
for _, event := range at.Events {
if event == configs.BeforeCreate || event == configs.BeforeUpdate {
switch event {
case configs.BeforeCreate, configs.BeforeUpdate:
containsBeforeEvent = true
} else if event == configs.AfterCreate || event == configs.AfterUpdate {
case configs.AfterCreate, configs.AfterUpdate:
containsAfterEvent = true
}
}
Expand Down
4 changes: 2 additions & 2 deletions internal/terraform/transform_attach_config_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ type GraphNodeAttachResourceConfig interface {

// AttachResourceConfigTransformer goes through the graph and attaches
// resource configuration structures to nodes that implement
// GraphNodeAttachManagedResourceConfig or GraphNodeAttachDataResourceConfig.
// GraphNodeAttachResourceConfig.
//
// The attached configuration structures are directly from the configuration.
// If they're going to be modified, a copy should be made.
Expand Down Expand Up @@ -53,7 +53,7 @@ func (t *AttachResourceConfigTransformer) Transform(g *Graph) error {

// Go through and find GraphNodeAttachResource
for _, v := range g.Vertices() {
// Only care about GraphNodeAttachResource implementations
// Only care about GraphNodeAttachResourceConfig implementations
arn, ok := v.(GraphNodeAttachResourceConfig)
if !ok {
continue
Expand Down