use LegacyResourceSchema
rather than the previous .CoreConfigSchemaForShimming
This commit is contained in:
parent
8730d99309
commit
a3d58665ad
|
@ -130,7 +130,7 @@ func TestDiffApply_set(t *testing.T) {
|
|||
"id": "testID",
|
||||
}
|
||||
|
||||
attrs, err := diff.Apply(priorAttrs, (&schema.Resource{Schema: resSchema}).CoreConfigSchemaForShimming())
|
||||
attrs, err := diff.Apply(priorAttrs, schema.LegacyResourceSchema(&schema.Resource{Schema: resSchema}).CoreConfigSchema())
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
|
|
@ -87,17 +87,22 @@ func (s *GRPCProviderServer) getDatasourceSchemaBlockForCore(name string) *confi
|
|||
}
|
||||
|
||||
func (s *GRPCProviderServer) getProviderSchemaBlockForShimming() *configschema.Block {
|
||||
return schema.InternalMap(s.provider.Schema).CoreConfigSchema()
|
||||
newSchema := map[string]*schema.Schema{}
|
||||
for attr, s := range s.provider.Schema {
|
||||
newSchema[attr] = schema.LegacySchema(s)
|
||||
}
|
||||
|
||||
return schema.InternalMap(newSchema).CoreConfigSchema()
|
||||
}
|
||||
|
||||
func (s *GRPCProviderServer) getResourceSchemaBlockForShimming(name string) *configschema.Block {
|
||||
res := s.provider.ResourcesMap[name]
|
||||
return res.CoreConfigSchema()
|
||||
return schema.LegacyResourceSchema(res).CoreConfigSchema()
|
||||
}
|
||||
|
||||
func (s *GRPCProviderServer) getDatasourceSchemaBlockForShimming(name string) *configschema.Block {
|
||||
dat := s.provider.DataSourcesMap[name]
|
||||
return dat.CoreConfigSchema()
|
||||
return schema.LegacyResourceSchema(dat).CoreConfigSchema()
|
||||
}
|
||||
|
||||
func (s *GRPCProviderServer) PrepareProviderConfig(_ context.Context, req *proto.PrepareProviderConfig_Request) (*proto.PrepareProviderConfig_Response, error) {
|
||||
|
@ -321,7 +326,7 @@ func (s *GRPCProviderServer) upgradeFlatmapState(version int, m map[string]strin
|
|||
// first determine if we need to call the legacy MigrateState func
|
||||
requiresMigrate := version < res.SchemaVersion
|
||||
|
||||
schemaType := res.CoreConfigSchema().ImpliedType()
|
||||
schemaType := schema.LegacyResourceSchema(res).CoreConfigSchema().ImpliedType()
|
||||
|
||||
// if there are any StateUpgraders, then we need to only compare
|
||||
// against the first version there
|
||||
|
|
|
@ -191,7 +191,6 @@ func (p *GRPCProvider) PrepareProviderConfig(r providers.PrepareProviderConfigRe
|
|||
|
||||
func (p *GRPCProvider) ValidateResourceTypeConfig(r providers.ValidateResourceTypeConfigRequest) (resp providers.ValidateResourceTypeConfigResponse) {
|
||||
log.Printf("[TRACE] GRPCProvider: ValidateResourceTypeConfig")
|
||||
|
||||
resourceSchema := p.getResourceSchema(r.TypeName)
|
||||
|
||||
mp, err := msgpack.Marshal(r.Config, resourceSchema.Block.ImpliedType())
|
||||
|
|
Loading…
Reference in New Issue