Repository navigation
Description
The gap
The CFN deployer's switch res.Type in emulator/betty_cfn.go has 109 cases and falls back
to deployGenericStub for anything else (with a "unknown CloudFormation resource type"
warning). That fallback is reasonable for services the emulator does not model — but four
resource types fall through to it even though the corresponding API actions are already
implemented and routed.
| CFN resource type | CFN deployer | API action, already implemented |
|---|---|---|
AWS::EC2::LaunchTemplate |
generic stub | CreateLaunchTemplate (ec2_plugin.go:188), DescribeLaunchTemplates (:190), DeleteLaunchTemplate (:192) |
AWS::EC2::SecurityGroupIngress |
generic stub | AuthorizeSecurityGroupIngress (ec2_plugin.go:90) |
AWS::IAM::InstanceProfile |
generic stub | CreateInstanceProfile (iam_plugin.go:153), AddRoleToInstanceProfile (:159), GetInstanceProfile (:155) |
AWS::EC2::NetworkInterface |
generic stub | — (no CreateNetworkInterface; genuinely absent) |
The first three are the interesting ones: the state-mutating handler exists, the wiring
doesn't.
Why it matters
The existing EC2 handlers show the intended pattern — deployEC2Instance dispatches a real
RunInstances (betty_cfn.go:2019), so an instance declared in a template is afterwards
visible to DescribeInstances. deployEC2SecurityGroup likewise dispatches
CreateSecurityGroup (:1934).
When a type falls to the generic stub, it gets a synthesized ARN and stack state but no
emulator-side resource. So a template that deploys "successfully" leaves you unable to
observe what it created:
- Deploy a stack with an
AWS::EC2::LaunchTemplate, then callDescribeLaunchTemplates→ not
there. The handler that would have created it is one dispatch away. - Deploy
AWS::IAM::InstanceProfile, thenGetInstanceProfile→ not there, and an
AWS::EC2::Instancein the same template referencing it viaIamInstanceProfilehas nothing
to resolve to. AWS::EC2::SecurityGroupIngressis a standalone rule resource (the common way to express a
self-referencing group, since it cannot be inline).deployEC2SecurityGroupalso ignores
inlineSecurityGroupIngressproperties, so neither route produces ingress rules —
meaningDescribeSecurityGroupsafter a stack deploy reports a group with no rules
regardless of how the template was written.
That last one is the sharpest: a test that asserts "my template opens port 6818 within the
compute security group" passes deploy and then can't verify the rule, in a way that looks like
the assertion is wrong rather than the emulator being silent.
Suggested fix
Add four cases following deployEC2Instance's existing shape — resolve properties, dispatch
the real action, record the physical ID from the response:
AWS::EC2::LaunchTemplate→CreateLaunchTemplate, physical ID fromlaunchTemplateId.AWS::IAM::InstanceProfile→CreateInstanceProfile+AddRoleToInstanceProfilefor each
entry inRoles.AWS::EC2::SecurityGroupIngress→AuthorizeSecurityGroupIngress, resolvingGroupId/
SourceSecurityGroupIdthrough the sameRef/GetAttpath other handlers use (a
self-referencing rule is the main reason this resource type exists standalone).- Optionally have
deployEC2SecurityGroupalso authorize inlineSecurityGroupIngress/
SecurityGroupEgressproperties, so both spellings behave the same.
AWS::EC2::NetworkInterface needs a CreateNetworkInterface handler first, so it is a
larger piece of work and arguably belongs in its own issue.
A cheap general improvement, independent of the above: have deployGenericStub note when the
unhandled type's service plugin is loaded. The current warning reads as "substrate doesn't
model this," which is misleading when the actions exist.
How I found it
Auditing the AWS surface of a Slurm power-save plugin
(scttfrdmn/aws-plugin-for-slurm) against
this emulator; its CloudFormation template declares all four of these. Filed separately from
the CreateFleet gap (#387) because this one is wiring between two layers that both already
exist, not a missing API. Not blocking me.
Activity
feat(ec2): CreateFleet with seedable partial fulfillment; wire four C…
feat(ec2): CreateFleet with seedable partial fulfillment; wire four C…
fix(cfn,config): the three AWS::Config resource types really deploy (#97