Skip to content

lambda/image: copy image with skopeo, support aws provider v6#18

Merged
sorah merged 7 commits into
mainfrom
skopeo
Jun 1, 2026
Merged

lambda/image: copy image with skopeo, support aws provider v6#18
sorah merged 7 commits into
mainfrom
skopeo

Conversation

@sorah

@sorah sorah commented Jun 1, 2026

Copy link
Copy Markdown
Owner

Replace the docker-based image copy in the Lambda terraform with skopeo, and bring the modules up to AWS provider v6.

skopeo migration

  • copy image with skopeo not docker — replace the docker login/pull/tag/push shell script with a single skopeo copy run directly from the local-exec provisioner. The destination ECR credential comes from an ephemeral aws_ecr_authorization_token so it never lands in state, and is fed over stdin into a temporary authfile rather than a command-line argument to keep it out of the process argument list.
  • copy gains architecture inputskopeo copy defaults to --multi-arch system, selecting the image matching the host running Terraform rather than the Lambda's architecture. The new architecture input pins the platform via --override-os/-arch so the correct single-platform image is copied out of the multi-arch source index regardless of where apply runs. It uses Lambda's notation (x86_64/arm64), mapped to linux/amd64 and linux/arm64 internally.
  • seed authfile so skopeo login can read itmktemp creates a 0-byte file, but skopeo login reads the authfile to merge the new credential before writing it back. An empty file is invalid JSON, so login aborted with unexpected end of JSON input and copy-image never ran. The authfile is now seeded with an empty JSON object first.

AWS provider v6

  • drop registry_id — the aws_ecr_authorization_token ephemeral resource no longer accepts registry_id under v6; it only issues a token for the caller's own default registry, which already covers the repo created in the same account.
  • aws_region.current.region — the .name attribute on the aws_region data source is deprecated in favor of .region. Both modules are pinned to >= 6.0.

Misc

  • terraform/iam: role_name output — expose the created role name.
  • terraform/README: reflect skopeo-based image copy.

sorah and others added 6 commits June 2, 2026 08:06
Replace the docker login/pull/tag/push shell script with a single
skopeo copy run directly from the local-exec provisioner. The
destination ECR credential comes from an ephemeral
aws_ecr_authorization_token so it never lands in state, and is fed
over stdin into a temporary authfile rather than a command-line
argument to keep it out of the process argument list.

Requires Terraform >= 1.10 and aws provider >= 5.83 for the
ephemeral resource.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
skopeo copy defaults to --multi-arch system, which selects the image
matching the host running Terraform rather than the Lambda's
architecture. Pin the platform explicitly via --override-os/-arch so
the correct single-platform image is copied out of the multi-arch
source index regardless of where apply runs.

Input uses Lambda's notation (x86_64/arm64) and is mapped to the
image's linux/amd64 and linux/arm64 internally.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The aws_ecr_authorization_token ephemeral resource no longer accepts
registry_id under AWS provider v6; it only issues a token for the
caller's own default registry, which already covers the repo created
in the same account. Dropping the argument works on both v5.83+ and
v6.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
mktemp creates a 0-byte file, but skopeo login reads the authfile to
merge the new credential before writing it back. An empty file is
invalid JSON, so login aborted with "unexpected end of JSON input"
and copy-image never ran. Seed it with an empty JSON object first.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The .name attribute on the aws_region data source is deprecated in
AWS provider v6 in favor of .region. Pin both modules to >= 6.0 since
the new attribute (and the ephemeral ECR token already in use) require
it.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@sorah sorah changed the title lambda/image: copy image with skopeo not docker lambda/image: copy image with skopeo, support aws provider v6 Jun 1, 2026
@sorah
sorah merged commit 301abb6 into main Jun 1, 2026
2 checks passed
@sorah
sorah deleted the skopeo branch June 1, 2026 23:27
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