docs(iam): settle a distribution's IAM certificate on what AWS publishes (#7740)

CloudFront resolves ViewerCertificate.IAMCertificateId by id alone, and two
questions about that have sat open. A server certificate meant for CloudFront
must be uploaded under /cloudfront, which nothing here enforces, and a blank
value is read as naming no certificate at all.

The blank is settled by AWS's own text, twice over. The member is declared with
a minimum length of 0, so an empty string breaks no bound it carries, and the
ViewerCertificate entry tells a caller on the CloudFront domain name to set
CloudFrontDefaultCertificate and leave all other fields empty. An element left
empty arrives as a blank on this REST XML protocol, so reading it as an id
would refuse the very request the reference asks for.

The path is a published obligation on the caller, in IAM's
UploadServerCertificate note and again in CloudFront's own procedure for
uploading a third-party certificate to IAM, and this emulator does not hold
callers to it. That is a deliberate divergence rather than a reading of what
AWS accepts. What is published is the obligation on the upload rather than a
refusal on the write: the Developer Guide's InvalidViewerCertificate page
enumerates what CloudFront verifies when an alternate domain name is added, in
the order it verifies them, and the certificate's path is not among those
checks. Holding a distribution to the path would refuse a write on a rule
published for the upload, so the id alone decides until something records
otherwise, and a capture of such a refusal moves the reader, the page and the
test.

The reasoning lives in docs/services/iam.md, with the CloudFront page and the
reader's javadoc pointing at it, and two tests pin what each case does: a
distribution created through the API with an empty IAMCertificateId element is
accepted and holds no certificate, and a certificate uploaded outside
/cloudfront serves a distribution and cannot be deleted while it does.
This commit is contained in:
Priamo Germosen authored and GitHub committed 2026-11-09 16:50:23 -06:00
1 parent 16ce8261eb
commit 69da60d07f
4 files changed
+145 -12

No files matched your search

@@ -298,6 +298,13 @@ public class CloudFrontService implements ServerCertificateReferenceProvider {
return certificateArn == null || certificateArn.isBlank() ? null : certificateArn;
}
/**
* The IAM certificate a distribution names, or null when the member is absent or blank. A
* blank is what a distribution on the CloudFront domain name sends, so it names no certificate
* rather than one that cannot be found. The {@code /cloudfront} upload path AWS documents for a
* certificate meant for CloudFront is deliberately not enforced here. Both are set out under
* Server Certificates in {@code docs/services/iam.md}.
*/
private static String iamCertificateId(DistributionConfig config) {
if (config == null || config.getViewerCertificate() == null) {
return null;