diff --git a/terraform/context_plan_test.go b/terraform/context_plan_test.go index 9abddf13d..786b04f34 100644 --- a/terraform/context_plan_test.go +++ b/terraform/context_plan_test.go @@ -1411,73 +1411,6 @@ func TestContext2Plan_moduleVarComputed(t *testing.T) { } } -func TestContext2Plan_nil(t *testing.T) { - m := testModule(t, "plan-nil") - p := testProvider("aws") - p.GetSchemaReturn = &ProviderSchema{ - ResourceTypes: map[string]*configschema.Block{ - "aws_instance": { - Attributes: map[string]*configschema.Attribute{ - "nil": {Type: cty.String, Optional: true}, - }, - }, - }, - } - p.DiffFn = testDiffFn - - ctx := testContext2(t, &ContextOpts{ - Config: m, - ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), - }, - ), - State: mustShimLegacyState(&State{ - Modules: []*ModuleState{ - &ModuleState{ - Path: rootModulePath, - Resources: map[string]*ResourceState{ - "aws_instance.foo": &ResourceState{ - Type: "aws_instance", - Primary: &InstanceState{ - ID: "bar", - }, - }, - }, - }, - }, - }), - }) - - plan, diags := ctx.Plan() - if diags.HasErrors() { - t.Fatalf("unexpected errors: %s", diags.Err()) - } - - if len(plan.Changes.Resources) != 1 { - t.Fatal("expected 1 changes, got", len(plan.Changes.Resources)) - } - schema := p.GetSchemaReturn.ResourceTypes["aws_instance"] - ty := schema.ImpliedType() - - for _, res := range plan.Changes.Resources { - if res.Action != plans.Update { - t.Fatalf("expected resource creation, got %s", res.Action) - } - ric, err := res.Decode(ty) - if err != nil { - t.Fatal(err) - } - - switch i := ric.Addr.String(); i { - case "aws_instance.foo": - checkVals(t, cty.NullVal(schema.ImpliedType()), ric.After) - default: - t.Fatal("unknown instance:", i) - } - } -} - func TestContext2Plan_preventDestroy_bad(t *testing.T) { m := testModule(t, "plan-prevent-destroy-bad") p := testProvider("aws") diff --git a/terraform/test-fixtures/plan-nil/main.tf b/terraform/test-fixtures/plan-nil/main.tf deleted file mode 100644 index 4e1b1885c..000000000 --- a/terraform/test-fixtures/plan-nil/main.tf +++ /dev/null @@ -1,3 +0,0 @@ -resource "aws_instance" "foo" { - nil = "1" -}