Backport of actions: allow invoke only on local execution while TFC adds support into v1.14 (#37654)

* backport of commit fa389d2e18

* backport of commit 941d46f334

---------

Co-authored-by: Liam Cervante <liam.cervante@hashicorp.com>
pull/37662/head
github-actions[bot] 8 months ago committed by GitHub
parent 6d2177d404
commit 6bb50f4056
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -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)

Loading…
Cancel
Save