Skip to content

Commit

Permalink
kms-keys: Skip keys already in pending replica deletion state (#1046)
Browse files Browse the repository at this point in the history
* kms-keys: Skip keys already in pending replica deletion state

Multi-region KMS keys enter state KeyStatePendingReplicaDeletion when
deleted, they should be filtered out in the list operation.

* Filter out PendingReplicaDeletion in the filter state rather than list state
  • Loading branch information
jbmchuck authored Aug 2, 2023
1 parent 06a0dfe commit 93f09c3
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions resources/kms-keys.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,10 @@ func (e *KMSKey) Filter() error {
return fmt.Errorf("is already in PendingDeletion state")
}

if e.state == "PendingReplicaDeletion" {
return fmt.Errorf("is already in PendingReplicaDeletion state")
}

if e.manager != nil && *e.manager == kms.KeyManagerTypeAws {
return fmt.Errorf("cannot delete AWS managed key")
}
Expand Down

0 comments on commit 93f09c3

Please sign in to comment.