diff --git a/resources/kms-key.go b/resources/kms-key.go index 0b5f46cb..af0c65f8 100644 --- a/resources/kms-key.go +++ b/resources/kms-key.go @@ -134,8 +134,8 @@ type KMSKey struct { } func (r *KMSKey) Filter() error { - if ptr.ToString(r.State) == kms.KeyStatePendingDeletion { - return fmt.Errorf("is already in PendingDeletion state") + if state := ptr.ToString(r.State); state == kms.KeyStatePendingDeletion || state == kms.KeyStatePendingReplicaDeletion { + return fmt.Errorf("is already in %v state", state) } if ptr.ToString(r.Manager) == kms.KeyManagerTypeAws { diff --git a/resources/kms-key_mock_test.go b/resources/kms-key_mock_test.go index a9fd1989..76a852cb 100644 --- a/resources/kms-key_mock_test.go +++ b/resources/kms-key_mock_test.go @@ -167,6 +167,12 @@ func Test_Mock_KMSKey_Filter(t *testing.T) { manager: kms.KeyManagerTypeCustomer, error: "is already in PendingDeletion state", }, + { + name: "pending-replica-deletion-key", + state: kms.KeyStatePendingReplicaDeletion, + manager: kms.KeyManagerTypeCustomer, + error: "is already in PendingReplicaDeletion state", + }, { name: "enabled-key", state: kms.KeyStateEnabled,