Repository navigation
Description
What is wrong
resolveStringProp (emulator/cfn_deployer.go:5836-5849) does a single flat map index:
v, ok := props[key]
if !ok {
return fallback
}No strings.Split(key, "."), no nested walk, no list indexing. Five call sites pass it a dotted key, and a CloudFormation template writes those properties as a nested object — so props never holds a key spelled with a dot, ok is always false, and the fallback wins unconditionally at all five. An exhaustive search for a dotted literal passed as a props key finds exactly these five, and resolveStringProp is the only resolve*Prop helper in the tree, so this is the complete set:
| Site | Key | Fallback returned every time | Impact |
|---|---|---|---|
cfn_resources_v26.go:346 |
Command.ScriptLocation |
"" |
Every Glue job created through CloudFormation ships an empty ScriptLocation, so GetJob reports none and the job has no script |
cfn_resources_v21.go:153 |
RequiresCompatibilities.0 |
"EC2" |
Every Fargate task definition registers as EC2 — the launch type the template asked for is never read |
cfn_resources_v26.go:345 |
Command.Name |
"glueetl" |
A pythonshell job is created as a Spark ETL job |
cfn_resources_v23.go:109 |
CloudFrontOriginAccessIdentityConfig.Comment |
logicalID |
#859 — feeds PhysicalID and hence Ref |
cfn_resources_v23.go:64 |
DistributionConfig.Comment |
logicalID |
Cosmetic: PhysicalID is recovered from the response Id, but the stored comment is wrong |
One apparent sixth hit is a false positive and must be left alone: "IpPermissions.1." (cfn_delete.go:658, cfn_resources_v77.go:191) is a prefix for EC2 query-protocol output parameter names, not a props key (see sgRuleParams, cfn_resources_v77.go:219-259). It is correct as written.
Why it matters
The top two change what resource an existing template produces, silently. A template that says
Job:
Type: AWS::Glue::Job
Properties:
Command:
Name: pythonshell
ScriptLocation: s3://bucket/etl.pydeploys a Spark ETL job with no script, reports success, and GetJob confirms an empty ScriptLocation — so a consumer testing that its template wires the script correctly gets a green run for a job that could not execute. Likewise a task definition with RequiresCompatibilities: [FARGATE] registers as EC2, and an ECS service that requires Fargate then reasons about the wrong launch type.
None of the five reports anything. There is no warning, no error, no drift — the fallback is indistinguishable from a template that omitted the property, which is exactly the case the fallback exists for.
What to do — fix the five sites, not the shared helper
Do not teach resolveStringProp to walk dotted paths. Two reasons, and both are load-bearing:
- It would turn ECS's launch type and Glue's command name from effective constants into template-controlled values at all five sites at once, silently, in one commit — a behaviour change to four unrelated resource types delivered as a helper refactor.
RequiresCompatibilities.0is an index into a list, not a map key. A dotted-path map walk does not fix it, so the shared-helper approach would leave the highest-impact site broken while appearing to have covered everything.
So each site reads its own nested value explicitly: props["Command"] as a map[string]interface{} then its "ScriptLocation", and props["RequiresCompatibilities"] as a []interface{} then element 0. Each keeps its current fallback for a genuinely absent property, and each resolves the value through resolveValue so an intrinsic in the nested position still works.
Consider whether resolveStringProp should refuse a key containing a dot outright, so a sixth site cannot be introduced the same way. A helper that silently returns the fallback for a key its lookup cannot express is the mechanism this issue is about, not just its five instances.
Acceptance criteria
- A CFN Glue job reports the template's
ScriptLocationthroughGetJob, and aCommand.Nameofpythonshellproduces apythonshelljob. - A task definition with
RequiresCompatibilities: [FARGATE]registersrequiresCompatibilities: ["FARGATE"], asserted throughDescribeTaskDefinitionrather than through the deploy's return value. - A CloudFront distribution stores the template's
DistributionConfig.Comment. -
CloudFrontOriginAccessIdentityConfig.Commentis read or the call is removed, not left silently dead (this is cfn: an origin access identity reports its logical ID as its physical ID, and its Comment lookup reads a dotted key in a flat map #859's first criterion; whichever way cfn: an origin access identity reports its logical ID as its physical ID, and its Comment lookup reads a dotted key in a flat map #859 resolves it, it stops being a dead lookup). - Each of the five sites has a test asserting the template's value reaches the resource. None has one today, which is why five sites could be wrong at once.
- An absent nested property still gets the site's documented fallback, asserted separately — the fix must not turn a legitimate default into an empty value.
- A decision is recorded on whether
resolveStringProprefuses a dotted key.
Compatibility
Every CFN Glue job now ships the template's ScriptLocation and command name, and every Fargate task definition registers as FARGATE instead of EC2. Both change the resource an existing template produces — which is the point, but a consumer asserting on the current wrong values will see those assertions fail.
Surfaced while researching #859, which is one of the five and the only one filed.
Activity