@@ -7,13 +7,13 @@ import (
77 "fmt"
88
99 "github.com/hashicorp/hcl/v2"
10+ "github.com/zclconf/go-cty/cty"
11+
1012 "github.com/hashicorp/terraform/internal/addrs"
11- "github.com/hashicorp/terraform/internal/configs"
1213 "github.com/hashicorp/terraform/internal/lang/langrefs"
1314 hcltest "github.com/hashicorp/terraform/internal/moduletest/hcl"
1415 "github.com/hashicorp/terraform/internal/terraform"
1516 "github.com/hashicorp/terraform/internal/tfdiags"
16- "github.com/zclconf/go-cty/cty"
1717)
1818
1919// GetVariables builds the terraform.InputValues required for the provided run
@@ -203,37 +203,3 @@ func (n *NodeTestRun) FilterVariablesToModule(values terraform.InputValues) (mod
203203 }
204204 return moduleVars , testOnlyVars , diags
205205}
206-
207- // AddVariablesToConfig extends the provided config to ensure it has definitions
208- // for all specified variables.
209- //
210- // This function is essentially the opposite of FilterVariablesToConfig which
211- // makes the variables match the config rather than the config match the
212- // variables.
213- func (n * NodeTestRun ) AddVariablesToConfig (variables terraform.InputValues ) {
214- run := n .run
215- // If we have got variable values from the test file we need to make sure
216- // they have an equivalent entry in the configuration. We're going to do
217- // that dynamically here.
218-
219- // First, take a backup of the existing configuration so we can easily
220- // restore it later.
221- currentVars := make (map [string ]* configs.Variable )
222- for name , variable := range run .ModuleConfig .Module .Variables {
223- currentVars [name ] = variable
224- }
225-
226- for name , value := range variables {
227- if _ , exists := run .ModuleConfig .Module .Variables [name ]; exists {
228- continue
229- }
230-
231- run .ModuleConfig .Module .Variables [name ] = & configs.Variable {
232- Name : name ,
233- Type : value .Value .Type (),
234- ConstraintType : value .Value .Type (),
235- DeclRange : value .SourceRange .ToHCL (),
236- }
237- }
238-
239- }
0 commit comments