configs/configupgrade: Populate the test provider schema
This will allow us to test some schema-sensitive migration rules.
This commit is contained in:
parent
8e594f32aa
commit
e8999eefdc
|
@ -9,6 +9,8 @@ import (
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
"github.com/zclconf/go-cty/cty"
|
||||||
|
|
||||||
backendinit "github.com/hashicorp/terraform/backend/init"
|
backendinit "github.com/hashicorp/terraform/backend/init"
|
||||||
"github.com/hashicorp/terraform/configs/configschema"
|
"github.com/hashicorp/terraform/configs/configschema"
|
||||||
"github.com/hashicorp/terraform/providers"
|
"github.com/hashicorp/terraform/providers"
|
||||||
|
@ -183,7 +185,24 @@ var testProviders = map[string]providers.Factory{
|
||||||
p := &terraform.MockProvider{}
|
p := &terraform.MockProvider{}
|
||||||
p.GetSchemaReturn = &terraform.ProviderSchema{
|
p.GetSchemaReturn = &terraform.ProviderSchema{
|
||||||
ResourceTypes: map[string]*configschema.Block{
|
ResourceTypes: map[string]*configschema.Block{
|
||||||
"test_resource": {},
|
"test_resource": {
|
||||||
|
Attributes: map[string]*configschema.Attribute{
|
||||||
|
"id": {Type: cty.String, Computed: true},
|
||||||
|
"type": {Type: cty.String, Optional: true},
|
||||||
|
"image": {Type: cty.String, Optional: true},
|
||||||
|
"tags": {Type: cty.Map(cty.String), Optional: true},
|
||||||
|
},
|
||||||
|
BlockTypes: map[string]*configschema.NestedBlock{
|
||||||
|
"network": {
|
||||||
|
Nesting: configschema.NestingSet,
|
||||||
|
Block: configschema.Block{
|
||||||
|
Attributes: map[string]*configschema.Attribute{
|
||||||
|
"cidr_block": {Type: cty.String, Computed: true},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
return p, nil
|
return p, nil
|
||||||
|
|
Loading…
Reference in New Issue