actions: remove unused variable (+ minor typos & comment cleanup) (#37804)

* actions: remove unused variable
* fix minor comments and logged typos
pull/37817/head
Kristin Laemmert 7 months ago committed by GitHub
parent a7e2c9f6b2
commit d4e8f17ded
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -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 {
@ -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.
@ -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)
}
@ -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,

@ -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))

@ -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
}
}

@ -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.
@ -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

Loading…
Cancel
Save