From d8d26106ef5634013d66d3249305046badaecb50 Mon Sep 17 00:00:00 2001 From: Josep Boix Requesens Date: Tue, 15 Oct 2024 14:09:57 +0200 Subject: [PATCH] feat: update ecr image tagging strategy to use stable for production - Modified Terraform configuration to tag ECR images with both `latest` and `stable`. - `Latest` is automatically applied to the dev environment for the latest version. - `stable` is manually tagged to indicate a version that is ready for promotion to the production environment. --- .../20-pillarbox-monitoring-app/data_transfer_service.tf | 2 +- .../20-pillarbox-monitoring-app/locals.tf | 4 ++-- .../20-pillarbox-monitoring-app/sse_broker_service.tf | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pillarbox-monitoring-terraform/20-pillarbox-monitoring-app/data_transfer_service.tf b/pillarbox-monitoring-terraform/20-pillarbox-monitoring-app/data_transfer_service.tf index fd161ef..d3847ba 100644 --- a/pillarbox-monitoring-terraform/20-pillarbox-monitoring-app/data_transfer_service.tf +++ b/pillarbox-monitoring-terraform/20-pillarbox-monitoring-app/data_transfer_service.tf @@ -50,7 +50,7 @@ resource "aws_ecs_task_definition" "transfer_task" { container_definitions = jsonencode([ { name = "pillarbox-monitoring-transfer" - image = "${local.ecr_repository}/pillarbox-monitoring-transfer:latest" + image = "${local.ecr_repository}/pillarbox-monitoring-transfer:${local.ecr_image_tag}" readonlyRootFilesystem = true # Port mapping for the container diff --git a/pillarbox-monitoring-terraform/20-pillarbox-monitoring-app/locals.tf b/pillarbox-monitoring-terraform/20-pillarbox-monitoring-app/locals.tf index a84cdb5..2ac09d5 100644 --- a/pillarbox-monitoring-terraform/20-pillarbox-monitoring-app/locals.tf +++ b/pillarbox-monitoring-terraform/20-pillarbox-monitoring-app/locals.tf @@ -4,7 +4,7 @@ locals { ecs_cluster_name = "${var.application_name}-cluster" is_prod = terraform.workspace == "prod" ecr_repository = "${var.account_ids["prod"]}.dkr.ecr.${data.aws_region.current.name}.amazonaws.com" - + ecr_image_tag = local.is_prod ? "stable" : "latest" opensearch = { domain_name = "${var.application_name}-search" @@ -33,4 +33,4 @@ locals { "srg-businessowner" = "pillarbox" "srg-environment" = terraform.workspace } -} \ No newline at end of file +} diff --git a/pillarbox-monitoring-terraform/20-pillarbox-monitoring-app/sse_broker_service.tf b/pillarbox-monitoring-terraform/20-pillarbox-monitoring-app/sse_broker_service.tf index 489ad54..a15f789 100644 --- a/pillarbox-monitoring-terraform/20-pillarbox-monitoring-app/sse_broker_service.tf +++ b/pillarbox-monitoring-terraform/20-pillarbox-monitoring-app/sse_broker_service.tf @@ -275,7 +275,7 @@ resource "aws_ecs_task_definition" "dispatch_task" { container_definitions = jsonencode([ { name = "pillarbox-event-dispatcher" - image = "${local.ecr_repository}/pillarbox-event-dispatcher:latest" + image = "${local.ecr_repository}/pillarbox-event-dispatcher:${local.ecr_image_tag}" readonlyRootFilesystem = true portMappings = [