Skip to content

Commit

Permalink
ACMServiceManager.list_certificates_with_backoff: explicit key type f…
Browse files Browse the repository at this point in the history
…ilter added (ansible-collections#1570)

ACMServiceManager.list_certificates_with_backoff: explicit key type filter added

SUMMARY
Fixes ansible-collections#1567
ACM.Client.list_certificates requires explicit certificate type filter in order to return the non-RSA_2048 certificates too, and this is needed to ensure the idempotency of importing such certificates.
ISSUE TYPE


Bugfix Pull Request

COMPONENT NAME

acm

Reviewed-by: Mark Chappell
Reviewed-by: Alina Buzachis
  • Loading branch information
gsimon75 authored Jun 6, 2023
1 parent 3d045fd commit 3926a7d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 2 additions & 0 deletions changelogs/fragments/1567-list-certificate-all-key-types.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bugfixes:
- module_utils.acm - fixes list_certificates returning only RSA_2048 certificates (https://github.com/ansible-collections/amazon.aws/issues/1567).
15 changes: 14 additions & 1 deletion plugins/module_utils/acm.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,20 @@ def delete_certificate_with_backoff(self, arn):
@AWSRetry.jittered_backoff(delay=5, catch_extra_error_codes=["RequestInProgressException"])
def list_certificates_with_backoff(self, statuses=None):
paginator = self.client.get_paginator("list_certificates")
kwargs = dict()
# `list_certificates` requires explicit key type filter, or it returns only RSA_2048 certificates
kwargs = {
"Includes": {
"keyTypes": [
"RSA_1024",
"RSA_2048",
"RSA_3072",
"RSA_4096",
"EC_prime256v1",
"EC_secp384r1",
"EC_secp521r1",
],
},
}
if statuses:
kwargs["CertificateStatuses"] = statuses
return paginator.paginate(**kwargs).build_full_result()["CertificateSummaryList"]
Expand Down

0 comments on commit 3926a7d

Please sign in to comment.