From edf66705617f16a59529b8ac8f2cd32cafb44ffe Mon Sep 17 00:00:00 2001
From: edebrye <edebrye@ippon.fr>
Date: Wed, 24 Mar 2021 17:04:51 +0100
Subject: [PATCH] refactor dashboard / adding links to resources

---
 deploy/dashboard.tf                            | 2 ++
 deploy/templates/dashboards/dashboard.json.tpl | 6 +++---
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/deploy/dashboard.tf b/deploy/dashboard.tf
index d2cc8e7..38486f6 100644
--- a/deploy/dashboard.tf
+++ b/deploy/dashboard.tf
@@ -6,7 +6,9 @@ resource "aws_cloudwatch_dashboard" "main" {
       dynamodb_table_name = aws_dynamodb_table.main.name
       apigw_stage_name    = aws_api_gateway_stage.main.stage_name
       apigw_name          = aws_api_gateway_rest_api.main.name
+      api_id              = aws_api_gateway_rest_api.main.id
       aws_region          = var.aws_region
+
   })
 }
 
diff --git a/deploy/templates/dashboards/dashboard.json.tpl b/deploy/templates/dashboards/dashboard.json.tpl
index b386450..26d2f69 100644
--- a/deploy/templates/dashboards/dashboard.json.tpl
+++ b/deploy/templates/dashboards/dashboard.json.tpl
@@ -7,7 +7,7 @@
             "x": 0,
             "type": "text",
             "properties": {
-                "markdown": "\n# API Gateway\n"
+                "markdown": "\n# API Gateway\n - [${apigw_name}/${apigw_stage_name}](https://${aws_region}.console.aws.amazon.com/apigateway/home?region=${aws_region}#/apis/${api_id}/stages/${apigw_stage_name})\n"
             }
         },
         {
@@ -17,7 +17,7 @@
             "x": 0,
             "type": "text",
             "properties": {
-                "markdown": "\n# Lambdas\n"
+                "markdown": "\n# Lambdas \n%{for l in lambda_names} - [${l}](https://${aws_region}.console.aws.amazon.com/lambda/home?region=${aws_region}#/functions/${l}?tab=monitoring)\n%{endfor}\n"
             }
         },
         {
@@ -27,7 +27,7 @@
             "x": 0,
             "type": "text",
             "properties": {
-                "markdown": "\n# DynamoDB\n"
+                "markdown": "\n# DynamoDB\n - [${dynamodb_table_name}](https://${aws_region}.console.aws.amazon.com/dynamodb/home?region=${aws_region}#tables:selected=${dynamodb_table_name};tab=overview)\n"
             }
         },
         {
-- 
GitLab