rvn-lambda: don't create a module-owned ECR repo for image_registry - #83
Merged
kodiakhq[bot] merged 2 commits intoAug 2, 2026
Merged
Conversation
Gate ecr_repository_creation_enabled on build_source so image_registry Lambdas no longer create a module-owned ECR repository. Add a required initial_image_ref input used to construct image_uri for the function's first create; deploy-time image promotion stays authoritative. Hide ECR lifecycle inputs for image_registry. Co-Authored-By: brandon <brandon@flightcontrol.dev>
Contributor
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
Ravion Module Publish PlanDry run only. No Ravion API mutations were made.
Diffsrvn-lambda 0.3.3 -> 0.4.0--- remote
+++ compiled
build_source: image_registry
package_type: Image
type: string
+ - description: Tag or digest used only to create the function before its first deployment. It must already exist in the image repository above. Deployments promote the tag or digest you pass at deploy time; changing this value afterward has no effect. Do not include the repository URI.
+ id: initial_image_ref
+ label: Initial image tag or digest
+ placeholder: sha256:... or latest
+ required: true
+ show_when:
+ build_source: image_registry
+ package_type: Image
+ type: string
- add_button_label: Add cmd segment
default: []
description: Optional command arguments that override the image default command (CMD). Leave empty to use the image default.
@@
- id: section_ecr
label: Image registry lifecycle
show_when:
+ build_source:
+ - dockerfile
+ - nixpacks
lambda_type: regional
package_type: Image
type: section
@@
id: ecr_scan_on_push_enabled
label: Scan images on push
show_when:
+ build_source:
+ - dockerfile
+ - nixpacks
lambda_type: regional
package_type: Image
type: boolean
@@
id: ecr_force_deletion_enabled
label: Force delete image repository
show_when:
+ build_source:
+ - dockerfile
+ - nixpacks
lambda_type: regional
package_type: Image
type: boolean
@@
The Lambda Function module creates an AWS Lambda function, execution role, CloudWatch log group, optional artifact bucket, and a live alias that Ravion updates during deployments. Terraform provisions the long-lived function infrastructure with either a bootstrap zip package or a bootstrap container image. Deployments publish a new function version and move the live alias.
- Terraform source: [flightcontrolhq/modules/compute/lambda](https://github.com/flightcontrolhq/modules/tree/rvn-lambda@0.3.3/compute/lambda)
+ Terraform source: [flightcontrolhq/modules/compute/lambda](https://github.com/flightcontrolhq/modules/tree/rvn-lambda@0.4.0/compute/lambda)
## Use cases
@@
base_path: compute/lambda
branch: main
execution_environment_id: << module.input.execution_environment_id >>
- ref: rvn-lambda@0.3.3
+ ref: rvn-lambda@0.4.0
repo: https://github.com/flightcontrolhq/modules
stack_id: <<stack.id>>
terraform_variables:
@@
description: << module.input.description || nil >>
ecr_default_lifecycle_policy_enabled: true
ecr_force_deletion_enabled: << module.input.ecr_force_deletion_enabled >>
- ecr_repository_creation_enabled: << module.input.lambda_type != "edge" && module.input.package_type == "Image" >>
+ ecr_repository_creation_enabled: << module.input.lambda_type != "edge" && module.input.package_type == "Image" && module.input.build_source != "image_registry" >>
ecr_repository_name: << module.input.name >>
ecr_scan_on_push_enabled: << module.input.ecr_scan_on_push_enabled >>
environment_variables: '<< module.input.lambda_type == "edge" ? {} : (module.input.environment_variables || {}) >>'
@@
function_url_invoke_mode: << module.input.function_url_invoke_mode >>
handler: '<< module.input.package_type == "Zip" ? module.input.handler : nil >>'
image_config: '<< module.input.lambda_type == "edge" || module.input.package_type != "Image" ? nil : ((len(module.input.image_start_command || []) > 0 || len(module.input.image_entry_point || []) > 0 || module.input.image_working_directory) ? {command: (len(module.input.image_start_command || []) > 0 ? module.input.image_start_command : nil), entry_point: (len(module.input.image_entry_point || []) > 0 ? module.input.image_entry_point : nil), working_directory: module.input.image_working_directory} : nil) >>'
+ image_uri: '<< module.input.lambda_type != "edge" && module.input.package_type == "Image" && module.input.build_source == "image_registry" ? (module.input.initial_image_ref contains "sha256:" ? module.input.image_repository + "@" + module.input.initial_image_ref : module.input.image_repository + ":" + module.input.initial_image_ref) : nil >>'
kms_key_arn: '<< module.input.lambda_type == "edge" ? nil : (module.input.kms_key_arn || nil) >>'
lambda_at_edge_enabled: << module.input.lambda_type == "edge" >>
layers: '<< module.input.lambda_type == "edge" || module.input.package_type != "Zip" ? [] : module.input.layers >>' |
Comment on lines
+215
to
+223
| - id: initial_image_ref | ||
| label: Initial image tag or digest | ||
| type: string | ||
| description: Tag or digest used only to create the function before its first deployment. It must already exist in the image repository above. Deployments promote the tag or digest you pass at deploy time; changing this value afterward has no effect. Do not include the repository URI. | ||
| placeholder: sha256:... or latest | ||
| required: true | ||
| show_when: | ||
| package_type: Image | ||
| build_source: image_registry |
There was a problem hiding this comment.
Initial image refs lack validation
The new required initial_image_ref accepts empty, whitespace-containing, full-URI, and malformed digest values even though it is interpolated directly into image_uri; these inputs reach AWS as malformed references and defer the error until Lambda creation. Add input validation for the supported tag and sha256 digest forms.
Context Used: AGENTS.md (source)
Knowledge Base Used: Autoscaling and Lambda Compute Modules
Prompt To Fix With AI
This is a comment left during a code review.
Path: compute/lambda/rvn-lambda-definition.yml
Line: 215-223
Comment:
**Initial image refs lack validation**
The new required `initial_image_ref` accepts empty, whitespace-containing, full-URI, and malformed digest values even though it is interpolated directly into `image_uri`; these inputs reach AWS as malformed references and defer the error until Lambda creation. Add input validation for the supported tag and `sha256` digest forms.
**Context Used:** AGENTS.md ([source](https://github.com/flightcontrolhq/modules/blob/main/AGENTS.md))
**Knowledge Base Used:** [Autoscaling and Lambda Compute Modules](https://app.greptile.com/flightcontrol/-/custom-context/knowledge-base/flightcontrolhq/modules/-/docs/compute-other.md)
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.
flybayer
approved these changes
Aug 2, 2026
kodiakhq
Bot
deleted the
devin/1785690977-lambda-ecr-image-registry-gate
branch
August 2, 2026 17:40
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.
Summary
rvn-lambdacreated and managed a per-function ECR repository for every Image-package Lambda, even whenbuild_source = "image_registry"(images come from an externally managed repo and the module-owned repo only ever held theravion-bootstrapseed). This mirrorsrvn-ecs-webby gating repo creation onbuild_source.The complication vs. ECS: ECS bootstraps from a public placeholder image, but an Image Lambda must reference a real image in a private repo at
CreateFunctiontime. So we can't just drop the repo — we need a valid initial image from the external repo. Rather than assume:latestexists (that would fail the create if absent), this adds a required initial ref.Changes (all in the definition; the Terraform module already supported
image_uri+ecr_repository_creation_enabled=falsevia itsimage_package_configurationcheck):image_registry:initial_image_ref(shown only forimage_registry), used solely to build the create-timeimage_urifromimage_repository(digest →repo@ref, tag →repo:ref):image_uriisignore_changes), so editinginitial_image_refafter create has no effect — documented in the input.ecr_scan_on_push_enabled/ecr_force_deletion_enabledforimage_registry(no module repo to configure), matching the ECS approach.build.destinationsleft unchanged: forimage_registrythe build isdisabled, so the (now-null)ecr_repository_arnreference is unused — identical to the existingrvn-ecs-webconvention.Bootstrapping for
dockerfile/nixpacksis untouched: those still create a module-owned repo and seed the bootstrap image.Release:
0.3.3→0.4.0(behavior change — existingimage_registryinstances will have their module-owned repo removed on next apply, and the new input is required).Testing
tofu fmt -check -recursive,tofu init,tofu validate— passtofu test— addedimage_registry_no_module_ecr(asserts nomodule.ecr, no bootstrap, function created from externalimage_uri); 7/7 passrvn-lambdagating/initial_image_ref/image_uriregression test; 70/70 passNote:
make publish-local-devwas not run — this sandbox has noRAVION_API_TOKENor reachable local dev API.Link to Devin session: https://app.devin.ai/sessions/e4d439b5aa94444abe844384a6b1413e
Requested by: @flybayer
Greptile Summary
This PR changes image-registry Lambda bootstrapping to use an externally managed ECR image instead of creating a module-owned repository.
initial_image_refinput and constructs the create-time image URI from a tag or digest.image_registry.Confidence Score: 4/5
The PR is safe to merge, with a non-blocking input-validation gap that defers malformed image-reference errors until Lambda creation.
The external-image provisioning path is consistently gated and tested, but
initial_image_refis interpolated into the create-time URI without validating the documented tag-or-digest contract.Files Needing Attention: compute/lambda/rvn-lambda-definition.yml
Important Files Changed
Flowchart
%%{init: {'theme': 'neutral'}}%% flowchart LR Input["image_repository + initial_image_ref"] --> Ref{"Digest?"} Ref -->|"sha256:*"| Digest["repository@digest"] Ref -->|"tag"| Tag["repository:tag"] Digest --> Create["Create Lambda function"] Tag --> Create Create --> Deploy["Later Ravion deployments promote image_ref"] Managed["Module-owned ECR/bootstrap"] -. "disabled for image_registry" .-> CreatePrompt To Fix All With AI
Reviews (1): Last reviewed commit: "rvn-lambda: skip module-owned ECR repo f..." | Re-trigger Greptile
Context used (3)