Skip to content

Commit f708659

Browse files
authored
Publish dashboards only if grafana folder exists (#148)
1 parent caeebe0 commit f708659

File tree

12 files changed

+61
-4
lines changed

12 files changed

+61
-4
lines changed

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,8 +188,8 @@ No modules.
188188
| Name | Description | Type | Default | Required |
189189
|------|-------------|------|---------|:--------:|
190190
| <a name="input_aws_region"></a> [aws\_region](#input\_aws\_region) | AWS Region | `string` | n/a | yes |
191-
| <a name="input_create_dashboard_folder"></a> [create\_dashboard\_folder](#input\_create\_dashboard\_folder) | Boolean flag to enable Amazon Managed Grafana folder and dashboards | `bool` | `false` | no |
192-
| <a name="input_create_prometheus_data_source"></a> [create\_prometheus\_data\_source](#input\_create\_prometheus\_data\_source) | Boolean flag to enable Amazon Managed Grafana datasource | `bool` | `false` | no |
191+
| <a name="input_create_dashboard_folder"></a> [create\_dashboard\_folder](#input\_create\_dashboard\_folder) | Boolean flag to enable Amazon Managed Grafana folder and dashboards | `bool` | `true` | no |
192+
| <a name="input_create_prometheus_data_source"></a> [create\_prometheus\_data\_source](#input\_create\_prometheus\_data\_source) | Boolean flag to enable Amazon Managed Grafana datasource | `bool` | `true` | no |
193193
| <a name="input_enable_alertmanager"></a> [enable\_alertmanager](#input\_enable\_alertmanager) | Creates Amazon Managed Service for Prometheus AlertManager for all workloads | `bool` | `false` | no |
194194
| <a name="input_enable_managed_prometheus"></a> [enable\_managed\_prometheus](#input\_enable\_managed\_prometheus) | Creates a new Amazon Managed Service for Prometheus Workspace | `bool` | `true` | no |
195195
| <a name="input_grafana_api_key"></a> [grafana\_api\_key](#input\_grafana\_api\_key) | Grafana API key for the Amazon Managed Grafana workspace | `string` | n/a | yes |
@@ -203,13 +203,15 @@ No modules.
203203
| Name | Description |
204204
|------|-------------|
205205
| <a name="output_aws_region"></a> [aws\_region](#output\_aws\_region) | AWS Region |
206+
| <a name="output_grafana_dashboard_folder_created"></a> [grafana\_dashboard\_folder\_created](#output\_grafana\_dashboard\_folder\_created) | Boolean value indicating if the module created a dashboard folder in Amazon Managed Grafana |
206207
| <a name="output_grafana_dashboards_folder_id"></a> [grafana\_dashboards\_folder\_id](#output\_grafana\_dashboards\_folder\_id) | Grafana folder ID for automatic dashboards. Required by workload modules |
207208
| <a name="output_grafana_prometheus_datasource_test"></a> [grafana\_prometheus\_datasource\_test](#output\_grafana\_prometheus\_datasource\_test) | Grafana save & test URL for Amazon Managed Prometheus workspace |
208209
| <a name="output_managed_grafana_workspace_endpoint"></a> [managed\_grafana\_workspace\_endpoint](#output\_managed\_grafana\_workspace\_endpoint) | Amazon Managed Grafana workspace endpoint |
209210
| <a name="output_managed_grafana_workspace_id"></a> [managed\_grafana\_workspace\_id](#output\_managed\_grafana\_workspace\_id) | Amazon Managed Grafana workspace ID |
210211
| <a name="output_managed_prometheus_workspace_endpoint"></a> [managed\_prometheus\_workspace\_endpoint](#output\_managed\_prometheus\_workspace\_endpoint) | Amazon Managed Prometheus workspace endpoint |
211212
| <a name="output_managed_prometheus_workspace_id"></a> [managed\_prometheus\_workspace\_id](#output\_managed\_prometheus\_workspace\_id) | Amazon Managed Prometheus workspace ID |
212213
| <a name="output_managed_prometheus_workspace_region"></a> [managed\_prometheus\_workspace\_region](#output\_managed\_prometheus\_workspace\_region) | Amazon Managed Prometheus workspace region |
214+
| <a name="output_prometheus_data_source_created"></a> [prometheus\_data\_source\_created](#output\_prometheus\_data\_source\_created) | Boolean value indicating if the module created a prometheus data source in Amazon Managed Grafana |
213215
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
214216

215217
## Contributing

examples/existing-cluster-java/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,7 @@ terraform destroy -var-file=terraform.tfvars
224224
|------|-------------|------|---------|:--------:|
225225
| <a name="input_aws_region"></a> [aws\_region](#input\_aws\_region) | AWS Region | `string` | n/a | yes |
226226
| <a name="input_eks_cluster_id"></a> [eks\_cluster\_id](#input\_eks\_cluster\_id) | Name of the EKS cluster | `string` | n/a | yes |
227+
| <a name="input_enable_dashboards"></a> [enable\_dashboards](#input\_enable\_dashboards) | Enables or disables curated dashboards | `bool` | `true` | no |
227228
| <a name="input_grafana_api_key"></a> [grafana\_api\_key](#input\_grafana\_api\_key) | API key for authorizing the Grafana provider to make changes to Amazon Managed Grafana | `string` | n/a | yes |
228229
| <a name="input_managed_grafana_workspace_id"></a> [managed\_grafana\_workspace\_id](#input\_managed\_grafana\_workspace\_id) | Amazon Managed Grafana Workspace ID | `string` | n/a | yes |
229230
| <a name="input_managed_prometheus_workspace_id"></a> [managed\_prometheus\_workspace\_id](#input\_managed\_prometheus\_workspace\_id) | Amazon Managed Service for Prometheus Workspace ID | `string` | `""` | no |

examples/existing-cluster-java/main.tf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,10 @@ module "eks_monitoring" {
7171

7272
eks_cluster_id = var.eks_cluster_id
7373

74+
# control the publishing of dashboards by specifying the boolean value for the variable 'enable_dashboards', default is 'true'
75+
# the intention to publish is overruled depending upon whether grafana dashboard folder is created by the observability accelerator
76+
enable_dashboards = module.aws_observability_accelerator.grafana_dashboard_folder_created ? var.enable_dashboards : false
77+
7478
dashboards_folder_id = module.aws_observability_accelerator.grafana_dashboards_folder_id
7579
managed_prometheus_workspace_id = module.aws_observability_accelerator.managed_prometheus_workspace_id
7680

examples/existing-cluster-java/variables.tf

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,31 @@ variable "eks_cluster_id" {
22
description = "Name of the EKS cluster"
33
type = string
44
}
5+
56
variable "aws_region" {
67
description = "AWS Region"
78
type = string
89
}
10+
911
variable "managed_prometheus_workspace_id" {
1012
description = "Amazon Managed Service for Prometheus Workspace ID"
1113
type = string
1214
default = ""
1315
}
16+
1417
variable "managed_grafana_workspace_id" {
1518
description = "Amazon Managed Grafana Workspace ID"
1619
type = string
1720
}
21+
1822
variable "grafana_api_key" {
1923
description = "API key for authorizing the Grafana provider to make changes to Amazon Managed Grafana"
2024
type = string
2125
sensitive = true
2226
}
27+
28+
variable "enable_dashboards" {
29+
description = "Enables or disables curated dashboards"
30+
type = bool
31+
default = true
32+
}

examples/existing-cluster-nginx/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,7 @@ add this `managed_prometheus_region=xxx` and `managed_prometheus_workspace_id=ws
235235
|------|-------------|------|---------|:--------:|
236236
| <a name="input_aws_region"></a> [aws\_region](#input\_aws\_region) | AWS Region | `string` | n/a | yes |
237237
| <a name="input_eks_cluster_id"></a> [eks\_cluster\_id](#input\_eks\_cluster\_id) | EKS Cluster Id | `string` | n/a | yes |
238+
| <a name="input_enable_dashboards"></a> [enable\_dashboards](#input\_enable\_dashboards) | Enables or disables curated dashboards | `bool` | `true` | no |
238239
| <a name="input_grafana_api_key"></a> [grafana\_api\_key](#input\_grafana\_api\_key) | API key for authorizing the Grafana provider to make changes to Amazon Managed Grafana | `string` | n/a | yes |
239240
| <a name="input_managed_grafana_workspace_id"></a> [managed\_grafana\_workspace\_id](#input\_managed\_grafana\_workspace\_id) | Amazon Managed Grafana (AMG) workspace ID | `string` | n/a | yes |
240241
| <a name="input_managed_prometheus_workspace_id"></a> [managed\_prometheus\_workspace\_id](#input\_managed\_prometheus\_workspace\_id) | Amazon Managed Service for Prometheus (AMP) workspace ID | `string` | `""` | no |

examples/existing-cluster-nginx/main.tf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,10 @@ module "eks_monitoring" {
6767

6868
eks_cluster_id = var.eks_cluster_id
6969

70+
# control the publishing of dashboards by specifying the boolean value for the variable 'enable_dashboards', default is 'true'
71+
# the intention to publish is overruled depending upon whether grafana dashboard folder is created by the observability accelerator
72+
enable_dashboards = module.aws_observability_accelerator.grafana_dashboard_folder_created ? var.enable_dashboards : false
73+
7074
dashboards_folder_id = module.aws_observability_accelerator.grafana_dashboards_folder_id
7175
managed_prometheus_workspace_id = module.aws_observability_accelerator.managed_prometheus_workspace_id
7276

examples/existing-cluster-nginx/variables.tf

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,31 @@ variable "eks_cluster_id" {
22
description = "EKS Cluster Id"
33
type = string
44
}
5+
56
variable "aws_region" {
67
description = "AWS Region"
78
type = string
89
}
10+
911
variable "managed_prometheus_workspace_id" {
1012
description = "Amazon Managed Service for Prometheus (AMP) workspace ID"
1113
type = string
1214
default = ""
1315
}
16+
1417
variable "managed_grafana_workspace_id" {
1518
description = "Amazon Managed Grafana (AMG) workspace ID"
1619
type = string
1720
}
21+
1822
variable "grafana_api_key" {
1923
description = "API key for authorizing the Grafana provider to make changes to Amazon Managed Grafana"
2024
type = string
2125
sensitive = true
2226
}
27+
28+
variable "enable_dashboards" {
29+
description = "Enables or disables curated dashboards"
30+
type = bool
31+
default = true
32+
}

examples/existing-cluster-with-base-and-infra/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@ terraform destroy -var-file=terraform.tfvars
171171
|------|-------------|------|---------|:--------:|
172172
| <a name="input_aws_region"></a> [aws\_region](#input\_aws\_region) | AWS Region | `string` | n/a | yes |
173173
| <a name="input_eks_cluster_id"></a> [eks\_cluster\_id](#input\_eks\_cluster\_id) | Name of the EKS cluster | `string` | n/a | yes |
174+
| <a name="input_enable_dashboards"></a> [enable\_dashboards](#input\_enable\_dashboards) | Enables or disables curated dashboards | `bool` | `true` | no |
174175
| <a name="input_grafana_api_key"></a> [grafana\_api\_key](#input\_grafana\_api\_key) | API key for authorizing the Grafana provider to make changes to Amazon Managed Grafana | `string` | n/a | yes |
175176
| <a name="input_managed_grafana_workspace_id"></a> [managed\_grafana\_workspace\_id](#input\_managed\_grafana\_workspace\_id) | Amazon Managed Grafana Workspace ID | `string` | n/a | yes |
176177
| <a name="input_managed_prometheus_workspace_id"></a> [managed\_prometheus\_workspace\_id](#input\_managed\_prometheus\_workspace\_id) | Amazon Managed Service for Prometheus Workspace ID | `string` | `""` | no |

examples/existing-cluster-with-base-and-infra/main.tf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,10 @@ module "eks_monitoring" {
7777
# reusing existing certificate manager? defaults to true
7878
enable_cert_manager = true
7979

80+
# control the publishing of dashboards by specifying the boolean value for the variable 'enable_dashboards', default is 'true'
81+
# the intention to publish is overruled depending upon whether grafana dashboard folder is created by the observability accelerator
82+
enable_dashboards = module.aws_observability_accelerator.grafana_dashboard_folder_created ? var.enable_dashboards : false
83+
8084
dashboards_folder_id = module.aws_observability_accelerator.grafana_dashboards_folder_id
8185
managed_prometheus_workspace_id = module.aws_observability_accelerator.managed_prometheus_workspace_id
8286

examples/existing-cluster-with-base-and-infra/variables.tf

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,31 @@ variable "eks_cluster_id" {
22
description = "Name of the EKS cluster"
33
type = string
44
}
5+
56
variable "aws_region" {
67
description = "AWS Region"
78
type = string
89
}
10+
911
variable "managed_prometheus_workspace_id" {
1012
description = "Amazon Managed Service for Prometheus Workspace ID"
1113
type = string
1214
default = ""
1315
}
16+
1417
variable "managed_grafana_workspace_id" {
1518
description = "Amazon Managed Grafana Workspace ID"
1619
type = string
1720
}
21+
1822
variable "grafana_api_key" {
1923
description = "API key for authorizing the Grafana provider to make changes to Amazon Managed Grafana"
2024
type = string
2125
sensitive = true
2226
}
27+
28+
variable "enable_dashboards" {
29+
description = "Enables or disables curated dashboards"
30+
type = bool
31+
default = true
32+
}

0 commit comments

Comments
 (0)