Skip to content

Commit 20096aa

Browse files
authored
fix: IAM users PK should be account_id + id, not ARN (#1876)
There is an edge case where ARN should not be used as the primary key: if a user gets deleted and then a new user gets created, the same ARN may get assigned. Instead, we should use account_id + id
1 parent 3c597f6 commit 20096aa

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

  • plugins/source/aws/codegen/recipes

plugins/source/aws/codegen/recipes/iam.go

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,13 +228,24 @@ func IAMResources() []*Resource {
228228
{
229229
SubService: "users",
230230
Struct: &iamService.UserWrapper{},
231-
SkipFields: []string{"Arn", "Tags"},
231+
SkipFields: []string{"Arn", "AccountId", "Id", "Tags"},
232232
PostResourceResolver: `postIamUserResolver`,
233233
ExtraColumns: []codegen.ColumnDefinition{
234234
{
235235
Name: "arn",
236236
Type: schema.TypeString,
237237
Resolver: `schema.PathResolver("Arn")`,
238+
},
239+
{
240+
Name: "account_id",
241+
Type: schema.TypeString,
242+
Resolver: `schema.PathResolver("AccountId")`,
243+
Options: schema.ColumnCreationOptions{PrimaryKey: true},
244+
},
245+
{
246+
Name: "id",
247+
Type: schema.TypeString,
248+
Resolver: `schema.PathResolver("Id")`,
238249
Options: schema.ColumnCreationOptions{PrimaryKey: true},
239250
},
240251
{

0 commit comments

Comments
 (0)