mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-08 11:17:27 +00:00
| .. | ||
| main.tf | ||
| provider.tf | ||
| README.md | ||
| variables.tf | ||
Checklist for adding a new Lambda
1. Create the Lambda scaffold
-
Copy the template:
cp -r lambda/_template lambda/<lambda_name>
-
Update
variables.tfif required -
Ensure the Terraform module accepts:
lambda_namestageimage_uri
2. Add infrastructure prerequisites (shared stack)
-
Add a new ECR repository in:
infrastructure/terraform/shared/main.tf
-
Apply the shared stack (or let CI apply it on
prod) -
Verify the ECR repository exists in AWS
Note:
No Terraform outputs are required for the ECR repo.
The CI pipeline resolves the repository URL dynamically at build time.
3. Add Docker build configuration
- Create a
Dockerfilefor the Lambda - Verify the Dockerfile path and build context
- Add a new image build job in
deploy_terraform.ymlusing_build_image.yml
4. Wire the Lambda deploy job (CI)
- Add a deploy job using
_deploy_lambda.yml - Pass the following inputs:
lambda_namelambda_pathstageimage_uri(constructed asrepo@sha256:digest)
- Ensure the deploy job depends on the image build job
5. Deploy
- Push changes to GitHub
- CI will:
- Build and push the Docker image
- Resolve the image digest
- Deploy the Lambda using the immutable
image_uri
5. Delete
- Delete README if you used cp -r
Notes
- Terraform remote state is not used for image wiring
- Image tags are not used; deployments are digest-based
- By default, the template wires SQS → Lambda
To change this, update the Terraform inlambda/<lambda_name>
(e.g. EventBridge, API Gateway, direct invoke)
Rule of thumb
CI decides what image to deploy.
Terraform only deploys it.