Skip to content
This repository has been archived by the owner on Oct 15, 2024. It is now read-only.

Commit

Permalink
kms-keys: Skip keys already in pending deletion state (#551)
Browse files Browse the repository at this point in the history
  • Loading branch information
hligit authored Sep 3, 2020
1 parent bb0ea1d commit 0d7db11
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions resources/kms-keys.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,21 @@ func ListKMSKeys(sess *session.Session) ([]Resource, error) {
return false
}

if *resp.KeyMetadata.KeyManager == kms.KeyManagerTypeAws {
continue
}

if *resp.KeyMetadata.KeyState == kms.KeyStatePendingDeletion {
continue
}

kmsKey := &KMSKey{
svc: svc,
id: *resp.KeyMetadata.KeyId,
state: *resp.KeyMetadata.KeyState,
manager: resp.KeyMetadata.KeyManager,
}

if *kmsKey.manager == kms.KeyManagerTypeAws {
continue
}

tags, err := svc.ListResourceTags(&kms.ListResourceTagsInput{
KeyId: key.KeyId,
})
Expand Down

0 comments on commit 0d7db11

Please sign in to comment.