dflook / cloudformation-dns-certificate

Cloudformation DNS Validated Certificate Resource
MIT License
48 stars 13 forks source link

Race condition when creating/updating a large number of certificates #14

Closed danieljamesscott closed 1 year ago

danieljamesscott commented 3 years ago

I've hit a race condition when creating/updating a large number of certificates.

While in find_certificate, and checking whether the certificate domain name matches:

https://github.com/dflook/cloudformation-dns-certificate/blob/master/src/troposphere_dns_certificate/certificate.py#L126

I occasionally encounter a certificate object which does not contain a DomainName, leading to a KeyError.

Is it a good idea to change the conditional to something like:

domain_name = certificate.get('DomainName')
if domain_name and p['DomainName'].lower() == domain_name:
    ...

So that if the certificate is 'being created', and does not contain a domain name, then it checks the tags.

dflook commented 1 year ago

This is fixed in version 2.0.0