Repository navigation
Description
What real CloudFront does
UpdateDistribution replaces the entire configuration and rejects one that omits fields
the caller never set, one field per 400. I hit these in sequence against a real account
today, each a separate round trip:
IllegalUpdate: Aliases are missing for the resource
IllegalUpdate: The 'OriginCustomHeaders' field is missing
InvalidArgument: The parameter SmoothStreaming flag is missing
CreateDistribution happily defaults all of them, which is what makes this a trap: a config
that creates fine cannot be sent back. The correct pattern is read-modify-write —
GetDistributionConfig, overwrite only your own fields, UpdateDistribution — and the errors
above are how you discover that.
Why it's in scope
Purely API-observable: request validation and error codes, no resource internals. It sits in
the Implemented → Partial gap for UpdateDistribution — the nominal path works, but the
validation that teaches callers the right shape is missing.
Why I'd value it
I wrote a CloudFront deployer for foray with hand-written
fakes. The fakes accepted a from-scratch config, so my tests were green and my model was
self-consistent — and wrong. I found all three only on a live deploy, at one field per
round trip. An emulator that enforced them would have caught the whole class offline.
Suggested fidelity
On UpdateDistribution, require the fields real CloudFront requires and answer with the same
code/message. From what I hit, at minimum:
Aliasespresent (even{Quantity: 0}) → elseIllegalUpdate: Aliases are missing for the resource- each
Origins.Items[]carryingCustomHeaders→ elseIllegalUpdate: The 'OriginCustomHeaders' field is missing - each cache behaviour carrying
SmoothStreaming→ elseInvalidArgument: The parameter SmoothStreaming flag is missing
There are likely more in the same family (I stopped once mine passed): OriginPath,
TrustedSigners/TrustedKeyGroups, LambdaFunctionAssociations, FunctionAssociations,
FieldLevelEncryptionId, Compress, ConnectionAttempts/ConnectionTimeout, and for a custom
origin OriginReadTimeout/OriginKeepaliveTimeout. The AWS API reference marks required vs
optional per field, and per your fidelity policy that's the source of truth rather than my
sample.
Related, and more valuable to me if cheap
DeleteDistribution's preconditions, which are the other half of what bit me:
- an enabled distribution →
DistributionNotDisabled - a stale
If-Match→PreconditionFailed StatustransitioningInProgress → Deployedover the simulated clock, so the
disable → wait → delete loop can be exercised deterministically (Stateful + Fault-aware)
I modelled all three in my own fakes to test the teardown dance; having them in substrate would
mean not modelling them.
Reproduction
internal/deploy/cloudfront.go in foray builds the desired config and, on convergence,
read-modify-writes it (converge). Reverting that to send d.config(...) directly reproduces
the first error against real AWS immediately.
Activity
scttfrdmn commentedon Sep 26, 2026
Verified against
origin/main(57ab1d0, post-v0.120.0) — the claims above hold at current main:UpdateDistribution/DeleteDistributionare implemented, and none ofIllegalUpdate,DistributionNotDisabledorPreconditionFailedappear in the plugin.One thing I missed when filing: the Origin Access Control operations are absent entirely (
ListOriginAccessControls,CreateOriginAccessControl,GetOriginAccessControl,DeleteOriginAccessControl), as isCreateDistributionWithTags. For foray those block more than the validation gaps do — without OAC its CloudFront deploy can't run against substrate at all, since a private bucket behind a distribution is the whole point.Rolled up with the rest in #1274.
scttfrdmn commentedon Sep 26, 2026
Triaged to v0.122.0. Both halves are in scope and the second half is the one with the
dependency, so a note on each.
The required-field validation is cheap and lands as written: it is a rule about the request
body, so substrate can enforce it without recording any more of a distribution than it does today.
The three codes you hit —
IllegalUpdate: Aliases are missing for the resource,IllegalUpdate: The 'OriginCustomHeaders' field is missing,InvalidArgument: The parameter SmoothStreaming flag is missing— will be sourced the way yousuggest: the API reference's required/optional marking per member decides the set, and your sample
decides nothing except which three are certain. Where a message comes from your observation rather
than from the model it gets recorded as such in the release's
## Provenancesection, since theexact wording is not published anywhere.
The delete preconditions need groundwork, which is the real reason this is not a one-afternoon
issue:
PreconditionFailedon a staleIf-Matchneeds a per-distribution ETag, and substrate emits noETag for a distribution anywhere today.
DistributionNotDisabledis straightforward —Enabledis already recorded.InProgress → Deployedover the simulated clock is the piece that makes thedisable → wait → delete loop assertable, and it is worth having for exactly the reason you give:
the loop exists to handle a transition, so a test that never observes one is not testing it.
One more thing this issue picks up, because it is the natural home for it: a distribution starts
recording its
Origins. Read-modify-write is unfalsifiable untilGetDistributionConfiganswersback something a caller could have written — today it answers two of
DistributionConfig's fiverequired members, for the reason
docs/services.mdsets out under "A configuration is not adistribution". Recording the origins here also unblocks
OriginAccessControlInUse/409, which #1277deliberately leaves out for want of exactly that.
#1277 (the OAC set) is going first, since #1274 names it as the blocker; this follows it.
feat(#1277): the CloudFront origin access control family, and a tagge…
fix: CloudFormation scopes stacks by account and Region, CloudFront u…
scttfrdmn commentedon Oct 4, 2026
Shipped in #1383.
UpdateDistributionnow replaces the configuration rather than merging, and refuses the three omissions in the order and wording observed here:IllegalUpdate"Aliases are missing for the resource";IllegalUpdate"The 'OriginCustomHeaders' field is missing";InvalidArgument"The parameter SmoothStreaming flag is missing".CreateDistributionfills in those three defaults, so a read-modify-write throughGetDistributionConfiground-trips. Distributions carry an ETag that update and delete require asIf-Match, and deleting an enabled distribution isDistributionNotDisabled. CloudFormation's stack delete now disables first. The three messages and their order are recorded as observed provenance indocs/services.md.One part of the follow-up folded in here is not built: an observable
InProgress → Deployedwindow, which a deploy waiter polls. It needs a seedable progression, and is split out as #1381. Closing on the rest.