providers: Consistently use int64 for schema versions

The rest of Terraform is still using uint64 for this in various spots, but
we'll update that gradually later. We use int64 here because that matches
what's used in our protobuf definition, and unsigned integers are not
portable across all of the protobuf target languages anyway.
This commit is contained in:
Martin Atkins 2018-11-29 16:53:36 -08:00
parent 2fd016738a
commit 72e279e6b2
3 changed files with 5 additions and 5 deletions

View File

@ -34,7 +34,7 @@ func testApplyDiff(t *testing.T,
diff *terraform.InstanceDiff) { diff *terraform.InstanceDiff) {
testSchema := providers.Schema{ testSchema := providers.Schema{
Version: uint64(resource.SchemaVersion), Version: int64(resource.SchemaVersion),
Block: resourceSchemaToBlock(resource.Schema), Block: resourceSchemaToBlock(resource.Schema),
} }
@ -338,7 +338,7 @@ func TestShimResourceDiff_Timeout_diff(t *testing.T) {
} }
testSchema := providers.Schema{ testSchema := providers.Schema{
Version: uint64(r.SchemaVersion), Version: int64(r.SchemaVersion),
Block: resourceSchemaToBlock(r.Schema), Block: resourceSchemaToBlock(r.Schema),
} }

View File

@ -57,7 +57,7 @@ func protoSchemaNestedBlock(name string, b *configschema.NestedBlock) *proto.Sch
// ProtoToProviderSchema takes a proto.Schema and converts it to a providers.Schema. // ProtoToProviderSchema takes a proto.Schema and converts it to a providers.Schema.
func ProtoToProviderSchema(s *proto.Schema) providers.Schema { func ProtoToProviderSchema(s *proto.Schema) providers.Schema {
return providers.Schema{ return providers.Schema{
Version: uint64(s.Version), Version: s.Version,
Block: ProtoToConfigSchema(s.Block), Block: ProtoToConfigSchema(s.Block),
} }
} }

View File

@ -86,7 +86,7 @@ type GetSchemaResponse struct {
// Schema pairs a provider or resource schema with that schema's version. // Schema pairs a provider or resource schema with that schema's version.
// This is used to be able to upgrade the schema in UpgradeResourceState. // This is used to be able to upgrade the schema in UpgradeResourceState.
type Schema struct { type Schema struct {
Version uint64 Version int64
Block *configschema.Block Block *configschema.Block
} }
@ -135,7 +135,7 @@ type UpgradeResourceStateRequest struct {
TypeName string TypeName string
// Version is version of the schema that created the current state. // Version is version of the schema that created the current state.
Version int Version int64
// RawStateJSON and RawStateFlatmap contiain the state that needs to be // RawStateJSON and RawStateFlatmap contiain the state that needs to be
// upgraded to match the current schema version. Because the schema is // upgraded to match the current schema version. Because the schema is