mirror of
https://github.com/storytold/terraform-aws-observability-accelerator.git
synced 2026-10-09 00:09:43 +00:00
71b6f352bf
* Managed Grafana Workspace with Identity Centre Users (#83) * update kuberenetes and instance type * initial setup of managed grafana workspace and identity centre identities * cleanup * run precommit * output grafana workspace ID * add identity store id variable * remove API key * update outputs naming convention as per terraform guidelines * update docs and add versions * update variables type * update naming conventions * add managed policy arn for querying promethues * update readme * update workshop references to this * add role arn type * cleanup and simplification * remove workshop --------- Co-authored-by: charlie keegan <chakeega@amazon.com> Co-authored-by: Rodrigue Koffi <bonclay7@users.noreply.github.com> * Rename example * Update grafana example and base module references * Update example's reference * Cleanup and docs ref * Add docs * Update docs * TODO: add link after merge * Update managed-grafana.md --------- Co-authored-by: Charlie Keegan <91210223+charliekeeegan@users.noreply.github.com> Co-authored-by: charlie keegan <chakeega@amazon.com> Co-authored-by: Mark Beacom <7315957+mbeacom@users.noreply.github.com>
93 lines
3.0 KiB
Terraform
93 lines
3.0 KiB
Terraform
provider "aws" {
|
|
region = local.region
|
|
}
|
|
|
|
data "aws_eks_cluster_auth" "this" {
|
|
name = var.eks_cluster_id
|
|
}
|
|
|
|
data "aws_eks_cluster" "this" {
|
|
name = var.eks_cluster_id
|
|
}
|
|
|
|
provider "kubernetes" {
|
|
host = local.eks_cluster_endpoint
|
|
cluster_ca_certificate = base64decode(data.aws_eks_cluster.this.certificate_authority[0].data)
|
|
token = data.aws_eks_cluster_auth.this.token
|
|
}
|
|
|
|
provider "helm" {
|
|
kubernetes {
|
|
host = local.eks_cluster_endpoint
|
|
cluster_ca_certificate = base64decode(data.aws_eks_cluster.this.certificate_authority[0].data)
|
|
token = data.aws_eks_cluster_auth.this.token
|
|
}
|
|
}
|
|
|
|
locals {
|
|
region = var.aws_region
|
|
eks_cluster_endpoint = data.aws_eks_cluster.this.endpoint
|
|
create_new_workspace = var.managed_prometheus_workspace_id == "" ? true : false
|
|
tags = {
|
|
Source = "github.com/aws-observability/terraform-aws-observability-accelerator"
|
|
}
|
|
}
|
|
|
|
# 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
|
|
|
|
# reusing existing Amazon Managed Grafana workspace
|
|
managed_grafana_workspace_id = var.managed_grafana_workspace_id
|
|
grafana_api_key = var.grafana_api_key
|
|
|
|
tags = local.tags
|
|
}
|
|
|
|
# https://www.terraform.io/language/modules/develop/providers
|
|
# A module intended to be called by one or more other modules must not contain
|
|
# any provider blocks.
|
|
# This allows forcing dependency between base and workloads module
|
|
provider "grafana" {
|
|
url = module.aws_observability_accelerator.managed_grafana_workspace_endpoint
|
|
auth = var.grafana_api_key
|
|
}
|
|
|
|
module "eks_monitoring" {
|
|
source = "../../modules/eks-monitoring"
|
|
# source = "github.com/aws-observability/terraform-aws-observability-accelerator//modules/eks-monitoring?ref=v2.0.0"
|
|
|
|
# enable java metrics collection, dashboards and alerts rules creation
|
|
enable_java = true
|
|
|
|
eks_cluster_id = var.eks_cluster_id
|
|
|
|
dashboards_folder_id = module.aws_observability_accelerator.grafana_dashboards_folder_id
|
|
managed_prometheus_workspace_id = module.aws_observability_accelerator.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
|
|
|
|
# optional, defaults to 60s interval and 15s timeout
|
|
prometheus_config = {
|
|
global_scrape_interval = "60s"
|
|
global_scrape_timeout = "15s"
|
|
scrape_sample_limit = 2000
|
|
}
|
|
|
|
tags = local.tags
|
|
|
|
depends_on = [
|
|
module.aws_observability_accelerator
|
|
]
|
|
}
|