Skip to content

Commit

Permalink
Update examples
Browse files Browse the repository at this point in the history
  • Loading branch information
bonclay7 committed Jan 15, 2024
1 parent 40f6976 commit dad9666
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 38 deletions.
5 changes: 2 additions & 3 deletions examples/existing-cluster-with-base-and-infra/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Existing Cluster with the AWS Observability accelerator base module and Infrastructure monitoring
# Existing Cluster with the AWS Observability accelerator EKS Infrastructure monitoring

This example demonstrates how to use the AWS Observability Accelerator Terraform
modules with Infrastructure monitoring enabled.
Expand Down Expand Up @@ -35,7 +35,6 @@ View the full documentation for this example [here](https://aws-observability.gi

| Name | Source | Version |
|------|--------|---------|
| <a name="module_aws_observability_accelerator"></a> [aws\_observability\_accelerator](#module\_aws\_observability\_accelerator) | ../../ | n/a |
| <a name="module_eks_monitoring"></a> [eks\_monitoring](#module\_eks\_monitoring) | ../../modules/eks-monitoring | n/a |

## Resources
Expand All @@ -44,6 +43,7 @@ View the full documentation for this example [here](https://aws-observability.gi
|------|------|
| [aws_eks_cluster.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/eks_cluster) | data source |
| [aws_eks_cluster_auth.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/eks_cluster_auth) | data source |
| [aws_grafana_workspace.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/grafana_workspace) | data source |

## Inputs

Expand All @@ -60,7 +60,6 @@ View the full documentation for this example [here](https://aws-observability.gi

| Name | Description |
|------|-------------|
| <a name="output_aws_region"></a> [aws\_region](#output\_aws\_region) | AWS Region |
| <a name="output_eks_cluster_id"></a> [eks\_cluster\_id](#output\_eks\_cluster\_id) | EKS Cluster Id |
| <a name="output_eks_cluster_version"></a> [eks\_cluster\_version](#output\_eks\_cluster\_version) | EKS Cluster version |
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
40 changes: 10 additions & 30 deletions examples/existing-cluster-with-base-and-infra/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ data "aws_eks_cluster" "this" {
name = var.eks_cluster_id
}

data "aws_grafana_workspace" "this" {
workspace_id = var.managed_grafana_workspace_id
}

provider "kubernetes" {
host = local.eks_cluster_endpoint
cluster_ca_certificate = base64decode(data.aws_eks_cluster.this.certificate_authority[0].data)
Expand All @@ -33,28 +37,6 @@ locals {
}
}

# deploys the base module
module "aws_observability_accelerator" {
source = "../../"
# source = "github.com/aws-observability/terraform-aws-observability-accelerator?ref=v2.0.0"

aws_region = var.aws_region

# creates a new Amazon Managed Prometheus workspace, defaults to true
enable_managed_prometheus = local.create_new_workspace

# reusing existing Amazon Managed Prometheus if specified
managed_prometheus_workspace_id = var.managed_prometheus_workspace_id

# sets up the Amazon Managed Prometheus alert manager at the workspace level
enable_alertmanager = true

# reusing existing Amazon Managed Grafana workspace
managed_grafana_workspace_id = var.managed_grafana_workspace_id

tags = local.tags
}

module "eks_monitoring" {
source = "../../modules/eks-monitoring"
# source = "github.com/aws-observability/terraform-aws-observability-accelerator//modules/eks-monitoring?ref=v2.0.0"
Expand All @@ -75,15 +57,17 @@ module "eks_monitoring" {
grafana_api_key = var.grafana_api_key
target_secret_name = "grafana-admin-credentials"
target_secret_namespace = "grafana-operator"
grafana_url = module.aws_observability_accelerator.managed_grafana_workspace_endpoint
grafana_url = "https://${data.aws_grafana_workspace.this.endpoint}"

# control the publishing of dashboards by specifying the boolean value for the variable 'enable_dashboards', default is 'true'
enable_dashboards = var.enable_dashboards

managed_prometheus_workspace_id = module.aws_observability_accelerator.managed_prometheus_workspace_id
# creates a new Amazon Managed Prometheus workspace, defaults to true
enable_managed_prometheus = local.create_new_workspace
managed_prometheus_workspace_id = var.managed_prometheus_workspace_id

managed_prometheus_workspace_endpoint = module.aws_observability_accelerator.managed_prometheus_workspace_endpoint
managed_prometheus_workspace_region = module.aws_observability_accelerator.managed_prometheus_workspace_region
# sets up the Amazon Managed Prometheus alert manager at the workspace level
enable_alertmanager = true

# optional, defaults to 60s interval and 15s timeout
prometheus_config = {
Expand All @@ -94,8 +78,4 @@ module "eks_monitoring" {
enable_logs = true

tags = local.tags

depends_on = [
module.aws_observability_accelerator
]
}
5 changes: 0 additions & 5 deletions examples/existing-cluster-with-base-and-infra/outputs.tf
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
output "aws_region" {
description = "AWS Region"
value = module.aws_observability_accelerator.aws_region
}

output "eks_cluster_version" {
description = "EKS Cluster version"
value = module.eks_monitoring.eks_cluster_version
Expand Down

0 comments on commit dad9666

Please sign in to comment.