8000 actions: ensure splat operations are invalid by DanielMSchmidt · Pull Request #37545 · hashicorp/terraform · GitHub
[go: up one dir, main page]

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
31 changes: 31 additions & 0 deletions internal/terraform/context_plan_actions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2781,6 +2781,37 @@ resource "test_object" "a" {
}
},
},

"splat is not supported": {
module: map[string]string{
"main.tf": `
action "test_unlinked" "hello" {
count = 42
}
resource "test_object" "a" {
lifecycle {
action_trigger {
events = [before_create]
actions = [action.test_unlinked.hello[*]]
}
}
}
`,
},
expectPlanActionCalled: false,
expectPlanDiagnostics: func(m *configs.Config) tfdiags.Diagnostics {
return tfdiags.Diagnostics{}.Append(&hcl.Diagnostic{
Severity: hcl.DiagError,
Summary: "Invalid action expression",
Detail: "Unexpected expression found in action_triggers.actions.",
Subject: &hcl.Range{
Filename: filepath.Join(m.Module.SourceDir, "main.tf"),
Start: hcl.Pos{Line: 9, Column: 18, Byte: 161},
End: hcl.Pos{Line: 9, Column: 47, Byte: 190},
},
})
},
},
} {
t.Run(name, func(t *testing.T) {
if tc.toBeImplemented {
Expand Down
3 changes: 3 additions & 0 deletions internal/terraform/node_action_trigger_plan.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@ func (n *nodeActionTriggerPlanExpand) DynamicExpand(ctx EvalContext) (*Graph, tf

ref, evalActionDiags := evaluateActionExpression(n.lifecycleActionTrigger.actionExpr, repData)
diags = append(diags, evalActionDiags...)
if diags.HasErrors() {
continue
}

// The reference is either an action or action instance
var actionAddr addrs.AbsActionInstance
Expand Down
Loading
0