Skip to content

Commit

Permalink
2ndNov - Added condiotnal creation for Grafana WS and module versions…
Browse files Browse the repository at this point in the history
… for AMG, AMP
  • Loading branch information
ruchimo committed Nov 2, 2023
1 parent 8919e6c commit 382987b
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 4 deletions.
7 changes: 5 additions & 2 deletions modules/ecs-monitoring/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ See examples using this Terraform modules in the **Amazon ECS** section of [this

| Name | Source | Version |
|------|--------|---------|
| <a name="module_managed_grafana_default"></a> [managed\_grafana\_default](#module\_managed\_grafana\_default) | terraform-aws-modules/managed-service-grafana/aws | n/a |
| <a name="module_managed_prometheus_default"></a> [managed\_prometheus\_default](#module\_managed\_prometheus\_default) | terraform-aws-modules/managed-service-prometheus/aws | n/a |
| <a name="module_managed_grafana_default"></a> [managed\_grafana\_default](#module\_managed\_grafana\_default) | terraform-aws-modules/managed-service-grafana/aws | 2.1.0 |
| <a name="module_managed_prometheus_default"></a> [managed\_prometheus\_default](#module\_managed\_prometheus\_default) | terraform-aws-modules/managed-service-prometheus/aws | 2.2.2 |

## Resources

Expand All @@ -55,6 +55,7 @@ See examples using this Terraform modules in the **Amazon ECS** section of [this
|------|-------------|------|---------|:--------:|
| <a name="input_aws_ecs_cluster_name"></a> [aws\_ecs\_cluster\_name](#input\_aws\_ecs\_cluster\_name) | Name of your ECS cluster | `string` | n/a | yes |
| <a name="input_container_name"></a> [container\_name](#input\_container\_name) | Container Name for Adot | `string` | `"adot_new"` | no |
| <a name="input_create_managed_grafana_ws"></a> [create\_managed\_grafana\_ws](#input\_create\_managed\_grafana\_ws) | Creates a Workspace for Amazon Managed Grafana | `bool` | `true` | no |
| <a name="input_create_managed_prometheus_ws"></a> [create\_managed\_prometheus\_ws](#input\_create\_managed\_prometheus\_ws) | Creates a Workspace for Amazon Managed Prometheus | `bool` | `true` | no |
| <a name="input_ecs_adot_cpu"></a> [ecs\_adot\_cpu](#input\_ecs\_adot\_cpu) | CPU to be allocated for the ADOT ECS TASK | `string` | `"256"` | no |
| <a name="input_ecs_adot_mem"></a> [ecs\_adot\_mem](#input\_ecs\_adot\_mem) | Memory to be allocated for the ADOT ECS TASK | `string` | `"512"` | no |
Expand All @@ -72,4 +73,6 @@ See examples using this Terraform modules in the **Amazon ECS** section of [this
|------|-------------|
| <a name="output_grafana_workspace_endpoint"></a> [grafana\_workspace\_endpoint](#output\_grafana\_workspace\_endpoint) | The endpoint of the Grafana workspace |
| <a name="output_grafana_workspace_id"></a> [grafana\_workspace\_id](#output\_grafana\_workspace\_id) | The ID of the Grafana workspace |
| <a name="output_prometheus_workspace_id"></a> [prometheus\_workspace\_id](#output\_prometheus\_workspace\_id) | Identifier of the workspace |
| <a name="output_prometheus_workspace_prometheus_endpoint"></a> [prometheus\_workspace\_prometheus\_endpoint](#output\_prometheus\_workspace\_prometheus\_endpoint) | Prometheus endpoint available for this workspace |
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
4 changes: 4 additions & 0 deletions modules/ecs-monitoring/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand All @@ -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"
}

Expand Down
14 changes: 12 additions & 2 deletions modules/ecs-monitoring/outputs.tf
Original file line number Diff line number Diff line change
@@ -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, "")
}
6 changes: 6 additions & 0 deletions modules/ecs-monitoring/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 382987b

Please sign in to comment.