Repository navigation
Description
Summary
Filed for the record: fixed in v0.87.1, in the same PR as #516. The issue
exists so the change is attributable, the compatibility note has a home, and the
next reader does not conclude the deployer was simply careless.
StackDeployer set a resource's Error only when the dispatched request returned
a non-nil error. It never looked at resp.StatusCode — zero references in
emulator/betty_cfn.go. So a resource a plugin refused recorded no error at
all, and DescribeStackResources maps an empty error to CREATE_COMPLETE:
aws cloudformation create-stack --stack-name badname \
--template-body '{"Resources":{"B":{"Type":"AWS::S3::Bucket",
"Properties":{"BucketName":"no"}}}}'
aws cloudformation describe-stack-resources --stack-name badname
# was: CREATE_COMPLETE, with no bucket anywhere
aws s3api head-bucket --bucket no # 404
This is the worst shape a test emulator can have: the consumer's waiter converges
and their assertion passes, for a resource that does not exist.
Why it happened — two conventions, one handled
Plugins signal a client error two different ways, and both are in wide use:
| Convention | Plugins | Sites |
|---|---|---|
4xx *AWSResponse, nil error |
S3, IAM | 58 / 162 |
return nil, &AWSError{…} |
EC2, ECS, CloudWatch Logs, SQS | 49 / 27 / 20 / 5 |
PluginRegistry.RouteRequest passes both through unchanged — correctly, since the
4xx response is what a real endpoint puts on the wire. The deployer only ever
checked the error return, so the entire S3 and IAM surface was invisible to it
while EC2 and ECS worked. That asymmetry is why this survived #483's review.
The fix
One helper, cfnDispatchError, applied centrally inside StackDeployer.dispatch,
so all 31 if routeErr != nil { dr.Error = … } sites became correct without being
individually edited. The plugin's own error code is lifted out of the response body,
so the recorded reason is InvalidBucketName: The specified bucket is not valid.
rather than a bare status number.
deployS3Bucket also discarded its response with a bare _ = resp — the shape
that made this invisible in the first place — and now returns early rather than
configuring versioning and tagging on a bucket that was refused.
Compatibility
A resource that genuinely fails now reports CREATE_FAILED where it reported
CREATE_COMPLETE. A test asserting the old status was asserting a defect, but it
will still turn red. The stack status is unchanged, and substrate still does not
roll back (#520).
Provenance
The two-conventions counts come from grepping the plugin sources. The
CREATE_COMPLETE-for-a-nonexistent-bucket observation is #516's own reproduction,
which is what surfaced this.
Activity
fix(cloudformation): expand YAML short-form intrinsics, report a refu…
chore(release): v0.87.1 (#525)