@@ -15,8 +15,6 @@ import (
1515 "time"
1616
1717 plugin "github.com/hashicorp/go-plugin"
18- "github.com/hashicorp/hcl/v2"
19- "github.com/hashicorp/hcl/v2/hclsyntax"
2018 "github.com/hashicorp/terraform-svchost/disco"
2119 "github.com/hashicorp/terraform/internal/addrs"
2220 "github.com/hashicorp/terraform/internal/backend"
@@ -554,43 +552,6 @@ func (m *Meta) extendedFlagSet(n string) *flag.FlagSet {
554552 return f
555553}
556554
557- // parseTargetFlags must be called for any commands supporting -target
558- // arguments. This method attempts to parse each -target flag into an
559- // addrs.Target, storing in the Meta.targets slice.
560- //
561- // If any flags cannot be parsed, we rewrap the first error diagnostic with a
562- // custom title to clarify the source of the error. The normal approach of
563- // directly returning the diags from HCL or the addrs package results in
564- // confusing incorrect "source" results when presented.
565- func (m * Meta ) parseTargetFlags () tfdiags.Diagnostics {
566- var diags tfdiags.Diagnostics
567- m .targets = nil
568- for _ , tf := range m .targetFlags {
569- traversal , syntaxDiags := hclsyntax .ParseTraversalAbs ([]byte (tf ), "" , hcl.Pos {Line : 1 , Column : 1 })
570- if syntaxDiags .HasErrors () {
571- diags = diags .Append (tfdiags .Sourceless (
572- tfdiags .Error ,
573- fmt .Sprintf ("Invalid target %q" , tf ),
574- syntaxDiags [0 ].Detail ,
575- ))
576- continue
577- }
578-
579- target , targetDiags := addrs .ParseTarget (traversal )
580- if targetDiags .HasErrors () {
581- diags = diags .Append (tfdiags .Sourceless (
582- tfdiags .Error ,
583- fmt .Sprintf ("Invalid target %q" , tf ),
584- targetDiags [0 ].Description ().Detail ,
585- ))
586- continue
587- }
588-
589- m .targets = append (m .targets , target .Subject )
590- }
591- return diags
592- }
593-
594555// process will process any -no-color entries out of the arguments. This
595556// will potentially modify the args in-place. It will return the resulting
596557// slice, and update the Meta and Ui.
0 commit comments