Repository navigation
Description
What's missing
CloudFormation is not reachable over the wire. POST / with
Action=CreateStack returns:
ServiceNotAvailable (501): service not emulated: cloudformation
This is a routing gap, not a missing feature. The CFN implementation is
substantial and present — emulator/betty_cfn.go plus ~40
betty_cfn_v*_plugins.go files, covering parameters, outputs, conditions,
change sets (#289) and drift detection (#290). What's absent is a registered
Plugin for the cloudformation service, so an AWS SDK client can never reach
any of it.
RegisterDefaultPlugins (emulator/plugins.go) makes 64 registry.Register
calls and none is CloudFormation. cfPlugin at plugins.go:341 is CloudFront
— easy to mistake for CFN when scanning:
return fmt.Errorf("initialize cloudfront plugin: %w", err)Confirmed from both sides against ghcr.io/scttfrdmn/substrate:0.85.0:
$ curl -s localhost:4566/ready | jq -r '.plugins | length, (map(select(test("cloud"))) | join(" "))'
64
cloudfront cloudtrailand in source, grep -rn 'CreateStack' --include='*.go' . matches exactly one
line — a string inside an IAM policy document (iam_managed.go:917). There is no
CreateStack handler and no Name() string method returning cloudformation.
Why it's structural, not an oversight
Betty is an in-process Go client, which the README is explicit about:
deploy a CloudFormation template and validate it entirely in-process, no HTTP
server required, via the Betty client
betty := emulator.NewBettyClient(registry, store, state, tc, logger)
result, _ := betty.Deploy(ctx, cfnTemplate, emulator.Intent{MaxCost: 1.0})docs/fidelity.md:36 defines the capability the same way — "CFN-supported —
Betty models the relevant CloudFormation resource types for deploy/drift" — which
describes Betty's coverage, not a cloudformation endpoint.
So this may well be deliberate, and the ask is not "implement CloudFormation".
It's that the capability exists and is unreachable from any non-Go consumer.
Why it matters to a consumer
I'm the parsl-aws-provider
maintainer; substrate replaced LocalStack there as the integration emulator. That
project's detached mode provisions its bastion host as a CloudFormation stack,
which is the one thing it cannot test against substrate. Concretely:
tests/integration/test_substrate_modes.py:295skips with "substrate does not
emulate cloudformation; DetachedMode's bastion stack is covered against real
AWS in tests/aws/".- Two integration files stay on moto solely for this — 6 and 2
cf_client
references respectively — which is why
parsl-aws-provider#183
("retire moto where substrate now suffices") could only be answered partially.
Everything else in that issue's probe table is closed and released; this is one
of three remaining reasons moto stays.
A Python consumer can't call betty.Deploy, so "use Betty instead" isn't
available to boto3, the AWS CLI, Terraform, or CDK.
Two ways to resolve, either of which unblocks
- Register a
cloudformationplugin that translates the wire operations
(CreateStack,DescribeStacks,DescribeStackEvents,DeleteStack,
UpdateStack) onto the existing Betty machinery. The modelling work is done;
this is an adapter over it. - Document it as out of scope, and say so in
docs/services.mdand
docs/fidelity.md— that CFN is Go-in-process only and non-Go consumers should
keep another tool for stack tests. ThenServiceNotAvailablebecomes a
documented boundary rather than a surprise, and downstream projects can stop
re-probing it each release.
Option 2 is a legitimate answer and cheaper; I'd rather have the boundary written
down than have this sit open as an implied promise. Only flagging it because the
current state reads as a bug from outside: the docs advertise CloudFormation
support, and the wire says the service isn't emulated.
Reproduce
$ docker run -d -p 4566:4566 ghcr.io/scttfrdmn/substrate:0.85.0
$ aws --endpoint-url http://localhost:4566 cloudformation create-stack \
--stack-name probe --template-body '{"Resources":{}}'
An error occurred (ServiceNotAvailable) when calling the CreateStack operation:
service not emulated: cloudformation
Activity
scttfrdmn commentedon Aug 2, 2026
Fixed in
ff3521a(#503), shipping in v0.87.0. You asked for a decision either way, so here it is plainly: option 1 — register the plugin.Why the plugin rather than the boundary note. Two reasons, and the second is the one that settled it. First, the modelling was already done:
StackDeployerexposes 13 methods —Deploy,UpdateStack,DeleteStack,ListStacks, the five change-set operations, and the four drift operations — all of them Go-only. Documenting that as out of scope would have meant leaving working code unreachable. Second,README.mdanddocs/index.mdadvertise CloudFormation as a first-class target. Option 2 meant visibly walking that back; option 1 makes the advertisement true for every consumer instead of only Go ones. Your report reading as a bug from outside was the correct reading.The plugin is deliberately an adapter — no CFN logic moved into it. Every handler translates Query params in and XML out, and constructs a
StackDeployerthrough the existingNewStackDeployer(its fields are private, so that is the only route).CreateStack,UpdateStack,DeleteStack,DescribeStacks,ListStacks,GetTemplate,DescribeStackResources, the five change-set operations and the three drift operations are all on the wire, withParameters.member.N.ParameterKey/.ParameterValuereaching template parameter resolution.The assertion that matters most is that the two layers share one world. A test creates a stack over the wire containing an S3 bucket and an IAM role, then reaches the bucket through the S3 plugin over the wire — so a wire-created stack is not a private universe. The in-process
BettyClientpath is untouched and its suite passes unchanged; a wire-created stack is visible toListStacks. One detail worth knowing:BettyClient.Deployderives a stream ID ofdeploy-<unixnano>, while the plugin passes yourStackName, so the stack the wire created is the stackDescribeStacksfinds. The comment says why they differ.You asked for the boundary written down, and you get one — narrower than you proposed.
DescribeStackEventsreturnsUnsupportedOperation, and that is a scope decision, not an oversight. There is no event model behind it:CFNStackStatecarries a singleStatusstring, hardcoded"CREATE_COMPLETE". Synthesizing a plausibleCREATE_IN_PROGRESS → CREATE_COMPLETEpair per resource would be inventing observations a consumer might then assert against, which is the opposite of this repo's provenance discipline. A clearUnsupportedOperationtells a consumer polling events to pollDescribeStacksinstead; a fabricated sequence would tell them nothing was wrong. It is named indocs/services.md, asserted in a test so the decision is pinned rather than incidental, and filed as #501 with what a real model would need.Betty reports failures as
fmt.Errorfstrings, so the adapter maps them to AWS codes by matching sentinel prefixes: a missing stack →ValidationError400Stack with id <name> does not exist, a duplicate name →AlreadyExistsException400, an unparseable template →ValidationError. String matching at a boundary is not good, and typed errors inbetty_cfn.gowould remove it — filed as #502 rather than done here, to keep this PR an adapter.docs/fidelity.md's "CFN-supported" definition needed no change, and that is the point: it was already true at both layers, which is precisely why this looked like a bug from outside.chore(release): v0.87.0 (#515)
fix(cloudformation): deploy a stack into the calling account and regi…
chore(release): v0.87.1 (#525)