Skip to content

Commit 64cb24d

Browse files
committed
sort identity schema
1 parent 033f60e commit 64cb24d

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

helper/schema/core_schema_proto_test.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -680,20 +680,20 @@ func TestProtoIdentitySchema(t *testing.T) {
680680
expected: &tfprotov5.ResourceIdentitySchema{
681681
IdentityAttributes: []*tfprotov5.ResourceIdentitySchemaAttribute{
682682
{
683-
Name: "int",
684-
Type: tftypes.Number,
685-
Description: "foo bar baz",
686-
RequiredForImport: true,
683+
Name: "bool",
684+
Type: tftypes.Bool,
685+
OptionalForImport: true,
687686
},
688687
{
689688
Name: "float",
690689
Type: tftypes.Number,
691690
OptionalForImport: true,
692691
},
693692
{
694-
Name: "bool",
695-
Type: tftypes.Bool,
696-
OptionalForImport: true,
693+
Name: "int",
694+
Type: tftypes.Number,
695+
Description: "foo bar baz",
696+
RequiredForImport: true,
697697
},
698698
{
699699
Name: "string",

internal/plugin/convert/schema.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,8 @@ func ConfigSchemaToProto(ctx context.Context, b *configschema.Block) *tfprotov5.
175175
func ConfigIdentitySchemaToProto(ctx context.Context, identitySchema *configschema.Block) []*tfprotov5.ResourceIdentitySchemaAttribute {
176176
output := make([]*tfprotov5.ResourceIdentitySchemaAttribute, 0)
177177

178-
for name, a := range identitySchema.Attributes {
178+
for _, name := range sortedKeys(identitySchema.Attributes) {
179+
a := identitySchema.Attributes[name]
179180

180181
attr := &tfprotov5.ResourceIdentitySchemaAttribute{
181182
Name: name,

0 commit comments

Comments
 (0)