@ -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" )