Roll back test schema expansion and isolate
Isolate the test schema expansion, because having NestingSet in the schema actually necessitates [] values in the AttrsJson. While this didn't fail any tests on its addition, that is scary and so isolate this to the one test using it.
This commit is contained in:
parent
8cd72e51cb
commit
87b576da7a
|
@ -11818,7 +11818,39 @@ resource "test_resource" "foo" {
|
||||||
}`,
|
}`,
|
||||||
})
|
})
|
||||||
|
|
||||||
p := testProvider("test")
|
p := new(MockProvider)
|
||||||
|
p.ReadResourceFn = func(req providers.ReadResourceRequest) providers.ReadResourceResponse {
|
||||||
|
return providers.ReadResourceResponse{NewState: req.PriorState}
|
||||||
|
}
|
||||||
|
p.GetSchemaReturn = &ProviderSchema{
|
||||||
|
Provider: &configschema.Block{},
|
||||||
|
ResourceTypes: map[string]*configschema.Block{
|
||||||
|
"test_resource": {
|
||||||
|
Attributes: map[string]*configschema.Attribute{
|
||||||
|
"id": {
|
||||||
|
Type: cty.String,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"value": {
|
||||||
|
Type: cty.String,
|
||||||
|
Optional: true,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
BlockTypes: map[string]*configschema.NestedBlock{
|
||||||
|
"network_interface": {
|
||||||
|
Block: configschema.Block{
|
||||||
|
Attributes: map[string]*configschema.Attribute{
|
||||||
|
"network_interface_id": {Type: cty.String, Optional: true},
|
||||||
|
"device_index": {Type: cty.Number, Optional: true},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
Nesting: configschema.NestingSet,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
p.ApplyResourceChangeFn = testApplyFn
|
p.ApplyResourceChangeFn = testApplyFn
|
||||||
p.PlanResourceChangeFn = testDiffFn
|
p.PlanResourceChangeFn = testDiffFn
|
||||||
|
|
||||||
|
@ -12049,7 +12081,7 @@ resource "test_resource" "foo" {
|
||||||
}.Instance(addrs.NoKey).Absolute(addrs.RootModuleInstance),
|
}.Instance(addrs.NoKey).Absolute(addrs.RootModuleInstance),
|
||||||
&states.ResourceInstanceObjectSrc{
|
&states.ResourceInstanceObjectSrc{
|
||||||
Status: states.ObjectReady,
|
Status: states.ObjectReady,
|
||||||
AttrsJSON: []byte(`{"id":"foo", "value":"hello", "network_interface":[]}`),
|
AttrsJSON: []byte(`{"id":"foo", "value":"hello"}`),
|
||||||
// No AttrSensitivePaths present
|
// No AttrSensitivePaths present
|
||||||
},
|
},
|
||||||
addrs.AbsProviderConfig{
|
addrs.AbsProviderConfig{
|
||||||
|
|
|
@ -6701,10 +6701,10 @@ resource "test_resource" "foo" {
|
||||||
}.Instance(addrs.NoKey).Absolute(addrs.RootModuleInstance),
|
}.Instance(addrs.NoKey).Absolute(addrs.RootModuleInstance),
|
||||||
&states.ResourceInstanceObjectSrc{
|
&states.ResourceInstanceObjectSrc{
|
||||||
Status: states.ObjectReady,
|
Status: states.ObjectReady,
|
||||||
AttrsJSON: []byte(`{"id":"foo", "value":"hello", "sensitive_value":"hello", "network_interface":[]}`),
|
AttrsJSON: []byte(`{"id":"foo", "value":"hello", "sensitive_value":"hello"}`),
|
||||||
AttrSensitivePaths: []cty.PathValueMarks{
|
AttrSensitivePaths: []cty.PathValueMarks{
|
||||||
cty.PathValueMarks{Path: cty.Path{cty.GetAttrStep{Name: "value"}}, Marks: cty.NewValueMarks("sensitive")},
|
{Path: cty.Path{cty.GetAttrStep{Name: "value"}}, Marks: cty.NewValueMarks("sensitive")},
|
||||||
cty.PathValueMarks{Path: cty.Path{cty.GetAttrStep{Name: "sensitive_value"}}, Marks: cty.NewValueMarks("sensitive")},
|
{Path: cty.Path{cty.GetAttrStep{Name: "sensitive_value"}}, Marks: cty.NewValueMarks("sensitive")},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
addrs.AbsProviderConfig{
|
addrs.AbsProviderConfig{
|
||||||
|
|
|
@ -599,15 +599,6 @@ func testProviderSchema(name string) *ProviderSchema {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
BlockTypes: map[string]*configschema.NestedBlock{
|
BlockTypes: map[string]*configschema.NestedBlock{
|
||||||
"network_interface": {
|
|
||||||
Block: configschema.Block{
|
|
||||||
Attributes: map[string]*configschema.Attribute{
|
|
||||||
"network_interface_id": {Type: cty.String, Optional: true},
|
|
||||||
"device_index": {Type: cty.Number, Optional: true},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
Nesting: configschema.NestingSet,
|
|
||||||
},
|
|
||||||
"nesting_single": {
|
"nesting_single": {
|
||||||
Block: configschema.Block{
|
Block: configschema.Block{
|
||||||
Attributes: map[string]*configschema.Attribute{
|
Attributes: map[string]*configschema.Attribute{
|
||||||
|
|
Loading…
Reference in New Issue