Skip to content

CloudFormation is unreachable over the wire: no cloudformation plugin is registered, so Betty's CFN support is Go-only #483

Closed

Description

@scttfrdmn

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 cloudtrail

and 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:295 skips 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

  1. Register a cloudformation plugin 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.
  2. Document it as out of scope, and say so in docs/services.md and
    docs/fidelity.md — that CFN is Go-in-process only and non-Go consumers should
    keep another tool for stack tests. Then ServiceNotAvailable becomes 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

  1. added
    type: feature
    area: server
    area: cloudformation
    priority: medium
    on Aug 2, 2026
  2. added this to the v0.87.0 milestone on Aug 2, 2026
  3. scttfrdmn commented on Aug 2, 2026

    @scttfrdmn
    OwnerAuthor

    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: StackDeployer exposes 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.md and docs/index.md advertise 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 StackDeployer through the existing NewStackDeployer (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, with Parameters.member.N.ParameterKey/.ParameterValue reaching 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 BettyClient path is untouched and its suite passes unchanged; a wire-created stack is visible to ListStacks. One detail worth knowing: BettyClient.Deploy derives a stream ID of deploy-<unixnano>, while the plugin passes your StackName, so the stack the wire created is the stack DescribeStacks finds. The comment says why they differ.

    You asked for the boundary written down, and you get one — narrower than you proposed. DescribeStackEvents returns UnsupportedOperation, and that is a scope decision, not an oversight. There is no event model behind it: CFNStackState carries a single Status string, hardcoded "CREATE_COMPLETE". Synthesizing a plausible CREATE_IN_PROGRESS → CREATE_COMPLETE pair per resource would be inventing observations a consumer might then assert against, which is the opposite of this repo's provenance discipline. A clear UnsupportedOperation tells a consumer polling events to poll DescribeStacks instead; a fabricated sequence would tell them nothing was wrong. It is named in docs/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.Errorf strings, so the adapter maps them to AWS codes by matching sentinel prefixes: a missing stack → ValidationError 400 Stack with id <name> does not exist, a duplicate name → AlreadyExistsException 400, an unparseable template → ValidationError. String matching at a boundary is not good, and typed errors in betty_cfn.go would 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: cloudformationarea: serverpriority: mediumtype: feature

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions