diff --git a/internal/command/apply_test.go b/internal/command/apply_test.go index 803f8c2b3b2c..89449163a722 100644 --- a/internal/command/apply_test.go +++ b/internal/command/apply_test.go @@ -860,7 +860,7 @@ func TestApply_plan_remoteState(t *testing.T) { func TestApply_planWithVarFile(t *testing.T) { varFileDir := testTempDir(t) varFilePath := filepath.Join(varFileDir, "terraform.tfvars") - if err := ioutil.WriteFile(varFilePath, []byte(applyVarFile), 0644); err != nil { + if err := os.WriteFile(varFilePath, []byte(applyVarFile), 0644); err != nil { t.Fatalf("err: %s", err) } @@ -878,6 +878,19 @@ func TestApply_planWithVarFile(t *testing.T) { defer os.Chdir(cwd) p := applyFixtureProvider() + p.GetProviderSchemaResponse = &providers.GetProviderSchemaResponse{ + ResourceTypes: map[string]providers.Schema{ + "test_instance": { + Block: &configschema.Block{ + Attributes: map[string]*configschema.Attribute{ + "id": {Type: cty.String, Computed: true}, + "value": {Type: cty.String, Optional: true}, + }, + }, + }, + }, + } + view, done := testView(t) c := &ApplyCommand{ Meta: Meta{ @@ -1863,7 +1876,7 @@ func TestApply_varFileDefault(t *testing.T) { defer testChdir(t, td)() varFilePath := filepath.Join(td, "terraform.tfvars") - if err := ioutil.WriteFile(varFilePath, []byte(applyVarFile), 0644); err != nil { + if err := os.WriteFile(varFilePath, []byte(applyVarFile), 0644); err != nil { t.Fatalf("err: %s", err) } @@ -2660,8 +2673,8 @@ func applyFixturePlanFileMatchState(t *testing.T, stateMeta statemgr.SnapshotMet func applyFixturePlanFileWithVariableValue(t *testing.T, value string) string { _, snap := testModuleWithSnapshot(t, "apply-vars") plannedVal := cty.ObjectVal(map[string]cty.Value{ - "id": cty.UnknownVal(cty.String), - "ami": cty.StringVal("bar"), + "id": cty.UnknownVal(cty.String), + "value": cty.StringVal("bar"), }) priorValRaw, err := plans.NewDynamicValue(cty.NullVal(plannedVal.Type()), plannedVal.Type()) if err != nil {