Skip to content

Commit

Permalink
Drop base module
Browse files Browse the repository at this point in the history
  • Loading branch information
bonclay7 committed Jan 15, 2024
1 parent 2ecdcd1 commit 40f6976
Show file tree
Hide file tree
Showing 10 changed files with 34 additions and 121 deletions.
17 changes: 0 additions & 17 deletions locals.tf

This file was deleted.

20 changes: 0 additions & 20 deletions main.tf

This file was deleted.

3 changes: 3 additions & 0 deletions modules/eks-monitoring/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ See examples using this Terraform modules in the **Amazon EKS** section of [this
|------|------|
| [aws_prometheus_rule_group_namespace.alerting_rules](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/prometheus_rule_group_namespace) | resource |
| [aws_prometheus_rule_group_namespace.recording_rules](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/prometheus_rule_group_namespace) | resource |
| [aws_prometheus_workspace.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/prometheus_workspace) | resource |
| [helm_release.fluxcd](https://registry.terraform.io/providers/hashicorp/helm/latest/docs/resources/release) | resource |
| [helm_release.grafana_operator](https://registry.terraform.io/providers/hashicorp/helm/latest/docs/resources/release) | resource |
| [helm_release.kube_state_metrics](https://registry.terraform.io/providers/hashicorp/helm/latest/docs/resources/release) | resource |
Expand All @@ -76,6 +77,7 @@ See examples using this Terraform modules in the **Amazon EKS** section of [this
| <a name="input_eks_cluster_id"></a> [eks\_cluster\_id](#input\_eks\_cluster\_id) | EKS Cluster Id | `string` | n/a | yes |
| <a name="input_enable_adotcollector_metrics"></a> [enable\_adotcollector\_metrics](#input\_enable\_adotcollector\_metrics) | Enables collection of ADOT collector metrics | `bool` | `true` | no |
| <a name="input_enable_alerting_rules"></a> [enable\_alerting\_rules](#input\_enable\_alerting\_rules) | Enables or disables Managed Prometheus alerting rules | `bool` | `true` | no |
| <a name="input_enable_alertmanager"></a> [enable\_alertmanager](#input\_enable\_alertmanager) | Creates Amazon Managed Service for Prometheus AlertManager for all workloads | `bool` | `false` | no |
| <a name="input_enable_amazon_eks_adot"></a> [enable\_amazon\_eks\_adot](#input\_enable\_amazon\_eks\_adot) | Enables the ADOT Operator on the EKS Cluster | `bool` | `true` | no |
| <a name="input_enable_apiserver_monitoring"></a> [enable\_apiserver\_monitoring](#input\_enable\_apiserver\_monitoring) | Enable EKS kube-apiserver monitoring, alerting and dashboards | `bool` | `true` | no |
| <a name="input_enable_cert_manager"></a> [enable\_cert\_manager](#input\_enable\_cert\_manager) | Allow reusing an existing installation of cert-manager | `bool` | `true` | no |
Expand All @@ -88,6 +90,7 @@ See examples using this Terraform modules in the **Amazon EKS** section of [this
| <a name="input_enable_java"></a> [enable\_java](#input\_enable\_java) | Enable Java workloads monitoring, alerting and default dashboards | `bool` | `false` | no |
| <a name="input_enable_kube_state_metrics"></a> [enable\_kube\_state\_metrics](#input\_enable\_kube\_state\_metrics) | Enables or disables Kube State metrics exporter. Disabling this might affect some data in the dashboards | `bool` | `true` | no |
| <a name="input_enable_logs"></a> [enable\_logs](#input\_enable\_logs) | Using AWS For FluentBit to collect cluster and application logs to Amazon CloudWatch | `bool` | `true` | no |
| <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 |
| <a name="input_enable_nginx"></a> [enable\_nginx](#input\_enable\_nginx) | Enable NGINX workloads monitoring, alerting and default dashboards | `bool` | `false` | no |
| <a name="input_enable_node_exporter"></a> [enable\_node\_exporter](#input\_enable\_node\_exporter) | Enables or disables Node exporter. Disabling this might affect some data in the dashboards | `bool` | `true` | no |
| <a name="input_enable_recording_rules"></a> [enable\_recording\_rules](#input\_enable\_recording\_rules) | Enables or disables Managed Prometheus recording rules | `bool` | `true` | no |
Expand Down
4 changes: 2 additions & 2 deletions modules/eks-monitoring/dashboards.tf
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ spec:
name: ${var.flux_gitrepository_name}
postBuild:
substitute:
AMG_AWS_REGION: ${var.managed_prometheus_workspace_region}
AMP_ENDPOINT_URL: ${var.managed_prometheus_workspace_endpoint}
AMG_AWS_REGION: ${local.managed_prometheus_workspace_region}
AMP_ENDPOINT_URL: ${local.managed_prometheus_workspace_endpoint}
AMG_ENDPOINT_URL: ${var.grafana_url}
GRAFANA_CLUSTER_DASH_URL: ${var.grafana_cluster_dashboard_url}
GRAFANA_KUBELET_DASH_URL: ${var.grafana_kubelet_dashboard_url}
Expand Down
11 changes: 8 additions & 3 deletions modules/eks-monitoring/locals.tf
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ data "aws_eks_cluster" "eks_cluster" {
}

locals {
# if region is not passed, we assume the current one
managed_prometheus_workspace_id = var.enable_managed_prometheus ? aws_prometheus_workspace.this[0].id : var.managed_prometheus_workspace_id
managed_prometheus_workspace_region = coalesce(var.managed_prometheus_workspace_region, data.aws_region.current.name)
managed_prometheus_workspace_endpoint = "https://aps-workspaces.${local.managed_prometheus_workspace_region}.amazonaws.com/workspaces/${local.managed_prometheus_workspace_id}/"

name = "adot-collector-kubeprometheus"
kube_service_account_name = try(var.helm_config.service_account, local.name)
namespace = try(var.helm_config.namespace, local.name)
Expand Down Expand Up @@ -46,7 +51,7 @@ locals {
flux_kustomization_name = "grafana-dashboards-java"
flux_kustomization_path = "./artifacts/grafana-operator-manifests/eks/java"

managed_prometheus_workspace_id = var.managed_prometheus_workspace_id
managed_prometheus_workspace_id = local.managed_prometheus_workspace_id
prometheus_metrics_endpoint = "/metrics"

grafana_dashboard_url = "https://raw.githubusercontent.com/aws-observability/aws-observability-accelerator/v0.2.0/artifacts/grafana-dashboards/eks/java/default.json"
Expand All @@ -67,7 +72,7 @@ locals {
flux_kustomization_name = "grafana-dashboards-nginx"
flux_kustomization_path = "./artifacts/grafana-operator-manifests/eks/nginx"

managed_prometheus_workspace_id = var.managed_prometheus_workspace_id
managed_prometheus_workspace_id = local.managed_prometheus_workspace_id
prometheus_metrics_endpoint = "/metrics"

grafana_dashboard_url = "https://raw.githubusercontent.com/aws-observability/aws-observability-accelerator/v0.2.0/artifacts/grafana-dashboards/eks/nginx/nginx.json"
Expand All @@ -88,7 +93,7 @@ locals {
flux_kustomization_name = "grafana-dashboards-istio"
flux_kustomization_path = "./artifacts/grafana-operator-manifests/eks/istio"

managed_prometheus_workspace_id = var.managed_prometheus_workspace_id
managed_prometheus_workspace_id = local.managed_prometheus_workspace_id
prometheus_metrics_endpoint = "/metrics"

dashboards = {
Expand Down
11 changes: 9 additions & 2 deletions modules/eks-monitoring/main.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
resource "aws_prometheus_workspace" "this" {
count = var.enable_managed_prometheus ? 1 : 0

alias = local.name
tags = var.tags
}

module "operator" {
source = "./add-ons/adot-operator"
count = var.enable_amazon_eks_adot ? 1 : 0
Expand Down Expand Up @@ -87,11 +94,11 @@ module "helm_addon" {
set_values = [
{
name = "ampurl"
value = "${var.managed_prometheus_workspace_endpoint}api/v1/remote_write"
value = "${local.managed_prometheus_workspace_endpoint}api/v1/remote_write"
},
{
name = "region"
value = var.managed_prometheus_workspace_region
value = local.managed_prometheus_workspace_region
},
{
name = "assumeRoleArn"
Expand Down
12 changes: 12 additions & 0 deletions modules/eks-monitoring/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,18 @@ variable "enable_amazon_eks_adot" {
default = true
}

variable "enable_managed_prometheus" {
description = "Creates a new Amazon Managed Service for Prometheus Workspace"
type = bool
default = true
}

variable "enable_alertmanager" {
description = "Creates Amazon Managed Service for Prometheus AlertManager for all workloads"
type = bool
default = false
}

variable "enable_cert_manager" {
description = "Allow reusing an existing installation of cert-manager"
type = bool
Expand Down
24 changes: 0 additions & 24 deletions outputs.tf

This file was deleted.

39 changes: 0 additions & 39 deletions variables.tf

This file was deleted.

14 changes: 0 additions & 14 deletions versions.tf

This file was deleted.

0 comments on commit 40f6976

Please sign in to comment.