Skip to content

feat(ecs): accept a resolvable ContainerDefinition.image - #164

Merged
JeroenSoeters merged 1 commit into
mainfrom
jeroensoeters/pla-495-ecs-containerdefinitionimage-lacks-resolvable-support
Aug 9, 2026
Merged

feat(ecs): accept a resolvable ContainerDefinition.image#164
JeroenSoeters merged 1 commit into
mainfrom
jeroensoeters/pla-495-ecs-containerdefinitionimage-lacks-resolvable-support

Conversation

@JeroenSoeters

Copy link
Copy Markdown
Contributor

Summary

AWS::ECS::TaskDefinition's ContainerDefinition.image was typed as a bare
String, the only reference-shaped field left on the task definition family
that was not a String|formae.Resolvable union. Its siblings
(Secret.valueFrom, RepositoryCredentials.credentialsParameter,
EFSVolumeConfiguration.filesystemId, TaskDefinition.executionRoleArn and
taskRoleArn) all accept a resolvable already.

The practical cost: nothing could wire a built image into a task definition. An
AWS::CodeBuild::ImageBuild publishes a digest and an AWS::ECR::Repository
publishes a URI, but neither could reach the image field. Passing a Resolvable
failed PKL type checking, and interpolating one into a string shipped the framed
envelope to RegisterTaskDefinition verbatim, which AWS rejects as invalid
characters. The workaround was to resolve the digest out of band, pin it as a
literal, and re-pin it by hand on every image rebuild.

Widening the type to String|formae.Resolvable removes that hand-edit.

Also adds a conformance fixture, testdata/ecs-taskdefinition-image-ref.pkl,
which creates an ECR repository from scratch and points the container image at
its resolved repositoryUri, so an apply fails outright if the reference does
not resolve. Confirmed it is a real regression test: it fails to evaluate
against the old bare-String type and passes with the new one. Fargate refuses
an ECR image without an execution role, so the fixture declares one; that
requirement is AWS's and is unrelated to the reference resolving.

The full conformance CRUD run passes (Create, Verify, Extract, Sync, Destroy and
out-of-band delete green; Update and Replace skipped, as there is no -update
variant, matching the sibling ecs-taskdefinition-secret-arn fixture).

ContainerDefinition.image was typed as a bare String, the only
reference-shaped field left on the ECS task definition family that was not
a String|formae.Resolvable union. Sibling fields (Secret.valueFrom,
RepositoryCredentials.credentialsParameter,
EFSVolumeConfiguration.filesystemId, TaskDefinition.executionRoleArn and
taskRoleArn) all accept one already.

The practical cost was that nothing could wire a built image into a task
definition. An AWS::CodeBuild::ImageBuild publishes a digest and an
AWS::ECR::Repository publishes a URI, but neither could reach the image
field: passing a Resolvable failed PKL type checking, and interpolating one
into a string shipped the framed envelope to RegisterTaskDefinition
verbatim, which AWS rejects as invalid characters. The workaround was to
resolve the digest out of band and pin it as a literal, then re-pin it by
hand on every image rebuild.

Widening the type to String|formae.Resolvable removes that hand-edit. The
conformance fixture ecs-taskdefinition-image-ref.pkl creates an ECR
repository from scratch and points the container image at its resolved
repositoryUri, so an apply fails outright if the reference does not
resolve. Fargate refuses an ECR image without an execution role, so the
fixture declares one; that requirement is AWS's and is unrelated to the
reference resolving.
@JeroenSoeters
JeroenSoeters merged commit 9f92682 into main Aug 9, 2026
8 checks passed
@JeroenSoeters
JeroenSoeters deleted the jeroensoeters/pla-495-ecs-containerdefinitionimage-lacks-resolvable-support branch August 9, 2026 00:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant