Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Replace the docker-based image copy in the Lambda terraform with
skopeo, and bring the modules up to AWS provider v6.skopeo migration
skopeo copyrun directly from thelocal-execprovisioner. The destination ECR credential comes from an ephemeralaws_ecr_authorization_tokenso 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.skopeo copydefaults to--multi-arch system, selecting the image matching the host running Terraform rather than the Lambda's architecture. The newarchitectureinput pins the platform via--override-os/-archso 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.mktempcreates a 0-byte file, butskopeo loginreads the authfile to merge the new credential before writing it back. An empty file is invalid JSON, so login aborted withunexpected end of JSON inputand copy-image never ran. The authfile is now seeded with an empty JSON object first.AWS provider v6
aws_ecr_authorization_tokenephemeral resource no longer acceptsregistry_idunder v6; it only issues a token for the caller's own default registry, which already covers the repo created in the same account..nameattribute on theaws_regiondata source is deprecated in favor of.region. Both modules are pinned to>= 6.0.Misc