configs/configupgrade: Populate the test provider schema

This will allow us to test some schema-sensitive migration rules.
This commit is contained in:
Martin Atkins 2018-11-30 16:40:11 -08:00
parent 8e594f32aa
commit e8999eefdc
1 changed files with 20 additions and 1 deletions

View File

@ -9,6 +9,8 @@ import (
"path/filepath"
"testing"
"github.com/zclconf/go-cty/cty"
backendinit "github.com/hashicorp/terraform/backend/init"
"github.com/hashicorp/terraform/configs/configschema"
"github.com/hashicorp/terraform/providers"
@ -183,7 +185,24 @@ var testProviders = map[string]providers.Factory{
p := &terraform.MockProvider{}
p.GetSchemaReturn = &terraform.ProviderSchema{
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