actions: allow invoke only on local execution while TFC adds support (#37653)

* actions: allow invoke only on local execution while TFC adds support

* actually return early
fix-query-action-interference
Liam Cervante 7 months ago committed by GitHub
parent e241e1ace1
commit e65c562355
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