@@ -76,8 +76,7 @@ func (b *Local) opPlan(
7676 b .ContextOpts = new (terraform.ContextOpts )
7777 }
7878
79- // Get our context
80- // first diagnostic
79+ // Set up backend and get our context
8180 lr , configSnap , opState , ctxDiags := b .localRun (op )
8281 diags = diags .Append (ctxDiags )
8382 if ctxDiags .HasErrors () {
@@ -106,7 +105,6 @@ func (b *Local) opPlan(
106105 defer logging .PanicHandler ()
107106 defer close (doneCh )
108107 log .Printf ("[INFO] backend/local: plan calling Plan" )
109- // second diagnostic
110108 plan , planDiags = lr .Core .Plan (lr .Config , lr .InputState , lr .PlanOpts )
111109 }()
112110
@@ -122,7 +120,9 @@ func (b *Local) opPlan(
122120 // NOTE: We intentionally don't stop here on errors because we always want
123121 // to try to present a partial plan report and, if the user chose to,
124122 // generate a partial saved plan file for external analysis.
125- diags = planDiags
123+ // Plan() may produce some diagnostic warnings which were already
124+ // produced when setting up context above, so we deduplicate them here.
125+ diags = diags .AppendWithoutDuplicates (planDiags ... )
126126
127127 // Even if there are errors we need to handle anything that may be
128128 // contained within the plan, so only exit if there is no data at all.
0 commit comments