Skip to content

cfn: resolveStringProp flat-indexes a dotted key, so five sites silently use their fallback — Glue ScriptLocation is always empty and every Fargate task definition registers as EC2 #877

Closed

Description

@scttfrdmn

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.py

deploys 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:

  1. 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.
  2. RequiresCompatibilities.0 is 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

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

  1. added this to the v0.116.0 milestone on Sep 15, 2026
  2. added
    type: bug
    on Sep 15, 2026
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

    type: bug

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions