Jul 6, 2023
A simple thing to try out is to use something like the below:
image_uri = "${repository_url}:${var.pipeline_id}"
In the gitlab environment, you can use predefined variables like pipeline_id as the unique id, and it won't be repeated every time for any project in the gitlab environment and then pass this value to your tf module.
The latest tag is always dangerous. If you are using CI/CD there should be a list of predefined variables that would come in handy.This way you don't even need to use source_code_hash for the lambda function. Also, set your ECR repo as immutable.
Not needed here but it is the best practice.