Skip to content

Commit 6bb50f4

Browse files
Backport of actions: allow invoke only on local execution while TFC adds support into v1.14 (#37654)
* backport of commit fa389d2 * backport of commit 941d46f --------- Co-authored-by: Liam Cervante <[email protected]>
1 parent 6d2177d commit 6bb50f4

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

internal/command/plan.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
"strings"
99

1010
"github.com/hashicorp/terraform/internal/backend/backendrun"
11+
"github.com/hashicorp/terraform/internal/backend/local"
1112
"github.com/hashicorp/terraform/internal/command/arguments"
1213
"github.com/hashicorp/terraform/internal/command/views"
1314
"github.com/hashicorp/terraform/internal/tfdiags"
@@ -78,6 +79,18 @@ func (c *PlanCommand) Run(rawArgs []string) int {
7879
return 1
7980
}
8081

82+
if len(args.Operation.ActionTargets) > 0 {
83+
if _, ok := be.(*local.Local); !ok {
84+
// Temporarily block invoking actions when executing anything other
85+
// than locally.
86+
// TODO: Remove this when TFC supports remote operation of action
87+
// invoke plans.
88+
diags = diags.Append(tfdiags.Sourceless(tfdiags.Error, "Invalid argument", "The -invoke argument can currently only be used when Terraform is executing locally."))
89+
view.Diagnostics(diags)
90+
return 1
91+
}
92+
}
93+
8194
// Build the operation request
8295
opReq, opDiags := c.OperationRequest(be, view, args.ViewType, args.Operation, args.OutPath, args.GenerateConfigPath)
8396
diags = diags.Append(opDiags)

0 commit comments

Comments
 (0)