diff --git a/modules/ecs-monitoring/README.md b/modules/ecs-monitoring/README.md index 8f6da073..e89f31ab 100644 --- a/modules/ecs-monitoring/README.md +++ b/modules/ecs-monitoring/README.md @@ -37,8 +37,8 @@ See examples using this Terraform modules in the **Amazon ECS** section of [this | Name | Source | Version | |------|--------|---------| -| [managed\_grafana\_default](#module\_managed\_grafana\_default) | terraform-aws-modules/managed-service-grafana/aws | n/a | -| [managed\_prometheus\_default](#module\_managed\_prometheus\_default) | terraform-aws-modules/managed-service-prometheus/aws | n/a | +| [managed\_grafana\_default](#module\_managed\_grafana\_default) | terraform-aws-modules/managed-service-grafana/aws | 2.1.0 | +| [managed\_prometheus\_default](#module\_managed\_prometheus\_default) | terraform-aws-modules/managed-service-prometheus/aws | 2.2.2 | ## Resources @@ -55,6 +55,7 @@ See examples using this Terraform modules in the **Amazon ECS** section of [this |------|-------------|------|---------|:--------:| | [aws\_ecs\_cluster\_name](#input\_aws\_ecs\_cluster\_name) | Name of your ECS cluster | `string` | n/a | yes | | [container\_name](#input\_container\_name) | Container Name for Adot | `string` | `"adot_new"` | no | +| [create\_managed\_grafana\_ws](#input\_create\_managed\_grafana\_ws) | Creates a Workspace for Amazon Managed Grafana | `bool` | `true` | no | | [create\_managed\_prometheus\_ws](#input\_create\_managed\_prometheus\_ws) | Creates a Workspace for Amazon Managed Prometheus | `bool` | `true` | no | | [ecs\_adot\_cpu](#input\_ecs\_adot\_cpu) | CPU to be allocated for the ADOT ECS TASK | `string` | `"256"` | no | | [ecs\_adot\_mem](#input\_ecs\_adot\_mem) | Memory to be allocated for the ADOT ECS TASK | `string` | `"512"` | no | @@ -72,4 +73,6 @@ See examples using this Terraform modules in the **Amazon ECS** section of [this |------|-------------| | [grafana\_workspace\_endpoint](#output\_grafana\_workspace\_endpoint) | The endpoint of the Grafana workspace | | [grafana\_workspace\_id](#output\_grafana\_workspace\_id) | The ID of the Grafana workspace | +| [prometheus\_workspace\_id](#output\_prometheus\_workspace\_id) | Identifier of the workspace | +| [prometheus\_workspace\_prometheus\_endpoint](#output\_prometheus\_workspace\_prometheus\_endpoint) | Prometheus endpoint available for this workspace | diff --git a/modules/ecs-monitoring/main.tf b/modules/ecs-monitoring/main.tf index af4d509c..537cf87a 100644 --- a/modules/ecs-monitoring/main.tf +++ b/modules/ecs-monitoring/main.tf @@ -12,7 +12,10 @@ resource "aws_ssm_parameter" "adot_config" { ############################################ module "managed_grafana_default" { + count = var.create_managed_grafana_ws ? 1 : 0 + source = "terraform-aws-modules/managed-service-grafana/aws" + version = "2.1.0" name = "${local.name}-default" associate_license = false } @@ -21,6 +24,7 @@ module "managed_prometheus_default" { count = var.create_managed_prometheus_ws ? 1 : 0 source = "terraform-aws-modules/managed-service-prometheus/aws" + version = "2.2.2" workspace_alias = "${local.name}-default" } diff --git a/modules/ecs-monitoring/outputs.tf b/modules/ecs-monitoring/outputs.tf index d9416986..9510c032 100644 --- a/modules/ecs-monitoring/outputs.tf +++ b/modules/ecs-monitoring/outputs.tf @@ -1,9 +1,19 @@ output "grafana_workspace_id" { description = "The ID of the Grafana workspace" - value = module.managed_grafana_default.workspace_id + value = try(module.managed_grafana_default[0].workspace_id, "") } output "grafana_workspace_endpoint" { description = "The endpoint of the Grafana workspace" - value = module.managed_grafana_default.workspace_endpoint + value = try(module.managed_grafana_default[0].workspace_endpoint, "") +} + +output "prometheus_workspace_id" { + description = "Identifier of the workspace" + value = try(module.managed_prometheus_default[0].id, "") +} + +output "prometheus_workspace_prometheus_endpoint" { + description = "Prometheus endpoint available for this workspace" + value = try(module.managed_prometheus_default[0].prometheus_endpoint, "") } diff --git a/modules/ecs-monitoring/variables.tf b/modules/ecs-monitoring/variables.tf index 7ce94c2b..c0e782ed 100644 --- a/modules/ecs-monitoring/variables.tf +++ b/modules/ecs-monitoring/variables.tf @@ -25,6 +25,12 @@ variable "ecs_adot_mem" { default = "512" } +variable "create_managed_grafana_ws" { + description = "Creates a Workspace for Amazon Managed Grafana" + type = bool + default = true +} + variable "create_managed_prometheus_ws" { description = "Creates a Workspace for Amazon Managed Prometheus" type = bool