From d73634676f36d5bc403e948532d637e8c87e51ca Mon Sep 17 00:00:00 2001 From: Loren Yu Date: Fri, 16 Feb 2024 16:20:43 -0800 Subject: [PATCH] Add IMAGE_TAG environment variable --- app/app.py | 5 ++++- infra/modules/service/main.tf | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/app/app.py b/app/app.py index 3fb4bdfe..68972c4f 100644 --- a/app/app.py +++ b/app/app.py @@ -32,7 +32,10 @@ def hello_world(): def health(): conn = get_db_connection() conn.execute("SELECT 1") - return "OK" + return { + "status": "healthy", + "version": os.environ.get("IMAGE_TAG"), + } @app.route("/migrations") diff --git a/infra/modules/service/main.tf b/infra/modules/service/main.tf index e21fb23a..05c89c0b 100644 --- a/infra/modules/service/main.tf +++ b/infra/modules/service/main.tf @@ -17,6 +17,7 @@ locals { { name : "PORT", value : tostring(var.container_port) }, { name : "AWS_DEFAULT_REGION", value : data.aws_region.current.name }, { name : "AWS_REGION", value : data.aws_region.current.name }, + { name : "IMAGE_TAG", value : var.image_tag }, ] db_environment_variables = var.db_vars == null ? [] : [ { name : "DB_HOST", value : var.db_vars.connection_info.host },