From 72554eeb955706545c257ab5102488e0eec3af09 Mon Sep 17 00:00:00 2001 From: jbeemster Date: Wed, 3 Apr 2024 12:22:49 +0200 Subject: [PATCH] ECR stuff --- main.tf | 4 +++- templates/user-data.sh.tmpl | 4 ++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/main.tf b/main.tf index 71e2992..eceebd1 100644 --- a/main.tf +++ b/main.tf @@ -256,7 +256,9 @@ locals { container_memory = "${module.instance_type_metrics.memory_application_mb}m" java_opts = var.java_opts - private_ecr_registry = var.private_ecr_registry + is_private_ecr_registry = local.is_private_ecr_registry + private_ecr_registry = var.private_ecr_registry + region = data.aws_region.current.name }) } diff --git a/templates/user-data.sh.tmpl b/templates/user-data.sh.tmpl index 8040307..9ac314f 100644 --- a/templates/user-data.sh.tmpl +++ b/templates/user-data.sh.tmpl @@ -5,6 +5,10 @@ sudo base64 --decode << EOF > $${CONFIG_DIR}/iglu-server.hocon ${config_b64} EOF +%{ if is_private_ecr_registry } +aws ecr get-login-password --region ${region} | docker login --username AWS --password-stdin ${private_ecr_registry} +%{ endif ~} + # Run the server setup set +e sudo docker run \