Current Setup : I have created a GITLAB CI Pipeline to build a JAR and use the JAR in a docker Image Build and publishing the same to an AWS ECR Repository
Points to Note :
- The image when it gets published is getting tagged using two tags one is the latest commit id that triggered the build and one is a custom tag called Latest.
The IaC being used is Terraform to deploy a Lambda Function that uses source file as ECR Repository URI.
image_uri = ECR Repo UrL:latest
On subsequent builds when new image is built the latest tag gets taken out from the old image and gets attached to the new image.
When i am trying to run Terraform Plan its unable to detect change in the Image even when the SHA value of the new image with latest tag has changed.
data "aws_ecr_repository" "service" {
name = "ecr-repository"
}
resource "aws_lambda_function" "test_lambda" {
image_uri = “${data.aws_ecr_repository.service.repository_url}:latest”
function_name = "lambda_function_name"
role = aws_iam_role.iam_for_lambda.arn
handler = "index.test"
runtime = "nodejs16.x"
environment {
variables = {
foo = "bar"
}
}
}