diff --git a/internal/command/apply.go b/internal/command/apply.go index 8e7bb461d0..cd0b1e958a 100644 --- a/internal/command/apply.go +++ b/internal/command/apply.go @@ -274,11 +274,11 @@ func (c *ApplyCommand) OperationRequest( opReq.Type = backendrun.OperationTypeApply opReq.View = view.Operation() opReq.StatePersistInterval = c.Meta.StatePersistInterval() + opReq.ActionTargets = args.ActionTargets // EXPERIMENTAL: maybe enable deferred actions if c.AllowExperimentalFeatures { opReq.DeferralAllowed = args.DeferralAllowed - opReq.ActionTargets = args.ActionTargets } else if args.DeferralAllowed { // Belated flag parse error, since we don't know about experiments // support at actual parse time. @@ -288,15 +288,6 @@ func (c *ApplyCommand) OperationRequest( "The -allow-deferral flag is only valid in experimental builds of Terraform.", )) return nil, diags - } else if len(args.ActionTargets) > 0 { - // Belated flag parse error, since we don't know about experiments - // support at actual parse time. - diags = diags.Append(tfdiags.Sourceless( - tfdiags.Error, - "Failed to parse command-line flags", - "The -invoke flag is only valid in experimental builds of Terraform.", - )) - return nil, diags } var err error diff --git a/internal/command/plan.go b/internal/command/plan.go index 1c2affaa84..a6f0b14001 100644 --- a/internal/command/plan.go +++ b/internal/command/plan.go @@ -164,11 +164,11 @@ func (c *PlanCommand) OperationRequest( opReq.ForceReplace = args.ForceReplace opReq.Type = backendrun.OperationTypePlan opReq.View = view.Operation() + opReq.ActionTargets = args.ActionTargets // EXPERIMENTAL: maybe enable deferred actions if c.AllowExperimentalFeatures { opReq.DeferralAllowed = args.DeferralAllowed - opReq.ActionTargets = args.ActionTargets } else if args.DeferralAllowed { // Belated flag parse error, since we don't know about experiments // support at actual parse time. @@ -178,15 +178,6 @@ func (c *PlanCommand) OperationRequest( "The -allow-deferral flag is only valid in experimental builds of Terraform.", )) return nil, diags - } else if len(args.ActionTargets) > 0 { - // Belated flag parse error, since we don't know about experiments - // support at actual parse time. - diags = diags.Append(tfdiags.Sourceless( - tfdiags.Error, - "Failed to parse command-line flags", - "The -invoke flag is only valid in experimental builds of Terraform.", - )) - return nil, diags } var err error