Skip to content

Commit b7d6c78

Browse files
ekristencorybekk
authored andcommitted
feat(kms-key): add kms alias to kms key for filtering purposes
1 parent 9f67c8d commit b7d6c78

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

resources/kms-key.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,17 @@ func (l *KMSKeyLister) List(_ context.Context, o interface{}) ([]resource.Resour
9898
}
9999
}
100100

101+
keyAliases, err := svc.ListAliases(&kms.ListAliasesInput{
102+
KeyId: key.KeyId,
103+
})
104+
if err != nil {
105+
logrus.WithError(err).Error("unable to list aliases")
106+
}
107+
108+
if len(keyAliases.Aliases) > 0 {
109+
kmsKey.Alias = keyAliases.Aliases[0].AliasName
110+
}
111+
101112
resources = append(resources, kmsKey)
102113
}
103114

@@ -118,6 +129,7 @@ type KMSKey struct {
118129
ID *string
119130
State *string
120131
Manager *string
132+
Alias *string
121133
Tags []*kms.Tag
122134
}
123135

0 commit comments

Comments
 (0)