diff --git a/internal/command/plan.go b/internal/command/plan.go index a6f0b1400181..73336696c4b5 100644 --- a/internal/command/plan.go +++ b/internal/command/plan.go @@ -8,6 +8,7 @@ import ( "strings" "github.com/hashicorp/terraform/internal/backend/backendrun" + "github.com/hashicorp/terraform/internal/backend/local" "github.com/hashicorp/terraform/internal/command/arguments" "github.com/hashicorp/terraform/internal/command/views" "github.com/hashicorp/terraform/internal/tfdiags" @@ -78,6 +79,18 @@ func (c *PlanCommand) Run(rawArgs []string) int { return 1 } + if len(args.Operation.ActionTargets) > 0 { + if _, ok := be.(*local.Local); !ok { + // Temporarily block invoking actions when executing anything other + // than locally. + // TODO: Remove this when TFC supports remote operation of action + // invoke plans. + diags = diags.Append(tfdiags.Sourceless(tfdiags.Error, "Invalid argument", "The -invoke argument can currently only be used when Terraform is executing locally.")) + view.Diagnostics(diags) + return 1 + } + } + // Build the operation request opReq, opDiags := c.OperationRequest(be, view, args.ViewType, args.Operation, args.OutPath, args.GenerateConfigPath) diags = diags.Append(opDiags)