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 \