From dc9a13a97541b250bec4b4784062586004864019 Mon Sep 17 00:00:00 2001 From: Nick Fagerlund Date: Wed, 3 Apr 2024 14:39:40 -0700 Subject: [PATCH] Catch a missing err check in apply command Plan and refresh already had this, but apply would deref a nil opReq and panic. --- internal/command/apply.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/internal/command/apply.go b/internal/command/apply.go index ebf29a27a2..e332f94b47 100644 --- a/internal/command/apply.go +++ b/internal/command/apply.go @@ -107,6 +107,10 @@ func (c *ApplyCommand) Run(rawArgs []string) int { // Build the operation request opReq, opDiags := c.OperationRequest(be, view, args.ViewType, planFile, args.Operation, args.AutoApprove) diags = diags.Append(opDiags) + if diags.HasErrors() { + view.Diagnostics(diags) + return 1 + } // Collect variable value and add them to the operation request diags = diags.Append(c.GatherVariables(opReq, args.Vars))