From c8f88d1a3109510317ae9c15de34f0b79dfbb36f Mon Sep 17 00:00:00 2001 From: Daniel Schmidt Date: Fri, 29 Aug 2025 16:25:20 +0200 Subject: [PATCH] fix rebasing errors --- .../terraform/context_plan_actions_test.go | 37 +++++++++---------- .../terraform/node_action_trigger_apply.go | 2 +- 2 files changed, 19 insertions(+), 20 deletions(-) diff --git a/internal/terraform/context_plan_actions_test.go b/internal/terraform/context_plan_actions_test.go index e59835a55a..fe7f01d72f 100644 --- a/internal/terraform/context_plan_actions_test.go +++ b/internal/terraform/context_plan_actions_test.go @@ -2477,15 +2477,14 @@ resource "test_object" "a" { expectPlanActionCalled: false, expectPlanDiagnostics: func(m *configs.Config) tfdiags.Diagnostics { - // We only expect one diagnostic, as the other condition is valid return tfdiags.Diagnostics{}.Append(&hcl.Diagnostic{ Severity: hcl.DiagError, Summary: "Self reference not allowed", Detail: `The condition expression cannot reference "self".`, Subject: &hcl.Range{ Filename: filepath.Join(m.Module.SourceDir, "main.tf"), - Start: hcl.Pos{Line: 11, Column: 19, Byte: 199}, - End: hcl.Pos{Line: 11, Column: 37, Byte: 217}, + Start: hcl.Pos{Line: 9, Column: 19, Byte: 197}, + End: hcl.Pos{Line: 9, Column: 37, Byte: 215}, }, }) }, @@ -2523,8 +2522,8 @@ resource "test_object" "a" { Detail: `The condition expression cannot reference "self".`, Subject: &hcl.Range{ Filename: filepath.Join(m.Module.SourceDir, "main.tf"), - Start: hcl.Pos{Line: 11, Column: 19, Byte: 198}, - End: hcl.Pos{Line: 11, Column: 37, Byte: 216}, + Start: hcl.Pos{Line: 9, Column: 19, Byte: 196}, + End: hcl.Pos{Line: 9, Column: 37, Byte: 214}, }, }) }, @@ -2557,8 +2556,8 @@ resource "test_object" "a" { Detail: `The condition expression cannot reference "each" if the action is run before the resource is applied.`, Subject: &hcl.Range{ Filename: filepath.Join(m.Module.SourceDir, "main.tf"), - Start: hcl.Pos{Line: 12, Column: 19, Byte: 237}, - End: hcl.Pos{Line: 12, Column: 36, Byte: 254}, + Start: hcl.Pos{Line: 10, Column: 19, Byte: 235}, + End: hcl.Pos{Line: 10, Column: 36, Byte: 252}, }, }).Append(&hcl.Diagnostic{ Severity: hcl.DiagError, @@ -2566,8 +2565,8 @@ resource "test_object" "a" { Detail: `The condition expression cannot reference "each" if the action is run before the resource is applied.`, Subject: &hcl.Range{ Filename: filepath.Join(m.Module.SourceDir, "main.tf"), - Start: hcl.Pos{Line: 12, Column: 19, Byte: 237}, - End: hcl.Pos{Line: 12, Column: 36, Byte: 254}, + Start: hcl.Pos{Line: 10, Column: 19, Byte: 235}, + End: hcl.Pos{Line: 10, Column: 36, Byte: 252}, }, }) }, @@ -2640,8 +2639,8 @@ resource "test_object" "a" { Detail: `The condition expression cannot reference "count" if the action is run before the resource is applied.`, Subject: &hcl.Range{ Filename: filepath.Join(m.Module.SourceDir, "main.tf"), - Start: hcl.Pos{Line: 11, Column: 19, Byte: 226}, - End: hcl.Pos{Line: 11, Column: 35, Byte: 242}, + Start: hcl.Pos{Line: 10, Column: 21, Byte: 237}, + End: hcl.Pos{Line: 10, Column: 37, Byte: 253}, }, }).Append(&hcl.Diagnostic{ Severity: hcl.DiagError, @@ -2649,8 +2648,8 @@ resource "test_object" "a" { Detail: `The condition expression cannot reference "count" if the action is run before the resource is applied.`, Subject: &hcl.Range{ Filename: filepath.Join(m.Module.SourceDir, "main.tf"), - Start: hcl.Pos{Line: 11, Column: 19, Byte: 226}, - End: hcl.Pos{Line: 11, Column: 35, Byte: 242}, + Start: hcl.Pos{Line: 10, Column: 21, Byte: 237}, + End: hcl.Pos{Line: 10, Column: 37, Byte: 253}, }, }).Append(&hcl.Diagnostic{ Severity: hcl.DiagError, @@ -2658,8 +2657,8 @@ resource "test_object" "a" { Detail: `The condition expression cannot reference "count" if the action is run before the resource is applied.`, Subject: &hcl.Range{ Filename: filepath.Join(m.Module.SourceDir, "main.tf"), - Start: hcl.Pos{Line: 11, Column: 19, Byte: 226}, - End: hcl.Pos{Line: 11, Column: 35, Byte: 242}, + Start: hcl.Pos{Line: 10, Column: 21, Byte: 237}, + End: hcl.Pos{Line: 10, Column: 37, Byte: 253}, }, }) }, @@ -2732,8 +2731,8 @@ resource "test_object" "a" { Detail: `The condition expression cannot reference "each" if the action is run before the resource is applied.`, Subject: &hcl.Range{ Filename: filepath.Join(m.Module.SourceDir, "main.tf"), - Start: hcl.Pos{Line: 11, Column: 19, Byte: 253}, - End: hcl.Pos{Line: 11, Column: 41, Byte: 275}, + Start: hcl.Pos{Line: 10, Column: 21, Byte: 264}, + End: hcl.Pos{Line: 10, Column: 43, Byte: 286}, }, }).Append(&hcl.Diagnostic{ Severity: hcl.DiagError, @@ -2741,8 +2740,8 @@ resource "test_object" "a" { Detail: `The condition expression cannot reference "each" if the action is run before the resource is applied.`, Subject: &hcl.Range{ Filename: filepath.Join(m.Module.SourceDir, "main.tf"), - Start: hcl.Pos{Line: 11, Column: 19, Byte: 253}, - End: hcl.Pos{Line: 11, Column: 41, Byte: 275}, + Start: hcl.Pos{Line: 10, Column: 21, Byte: 264}, + End: hcl.Pos{Line: 10, Column: 43, Byte: 286}, }, }) }, diff --git a/internal/terraform/node_action_trigger_apply.go b/internal/terraform/node_action_trigger_apply.go index 25ef998e3a..13c8dcadc3 100644 --- a/internal/terraform/node_action_trigger_apply.go +++ b/internal/terraform/node_action_trigger_apply.go @@ -40,7 +40,7 @@ func (n *nodeActionTriggerApply) Execute(ctx EvalContext, wo walkOperation) tfdi if n.ConditionExpr != nil { // We know this must be a lifecycle action, otherwise we would have no condition - at := actionInvocation.ActionTrigger.(plans.LifecycleActionTrigger) + at := actionInvocation.ActionTrigger.(*plans.LifecycleActionTrigger) condition, conditionDiags := evaluateActionCondition(ctx, actionConditionContext{ // For applying the triggering event is sufficient, if the condition could not have // been evaluated due to in invalid mix of events we would have caught it durin planning.