Skip to content

Commit

Permalink
Update x account example
Browse files Browse the repository at this point in the history
  • Loading branch information
bonclay7 committed Jan 15, 2024
1 parent 4f7bf31 commit 1d5f4d6
Showing 1 changed file with 18 additions and 32 deletions.
50 changes: 18 additions & 32 deletions examples/eks-cross-account-with-central-amp/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ locals {
# EKS Monitoring Addon for cluster one #
###########################################################################
module "eks_monitoring_one" {
source = "../../modules/eks-monitoring"
source = "../..//modules/eks-monitoring"
# source = "github.com/aws-observability/terraform-aws-observability-accelerator//modules/eks-monitoring?ref=v2.0.0"
providers = {
aws = aws.eks_cluster_one
Expand Down Expand Up @@ -36,11 +36,15 @@ module "eks_monitoring_one" {
grafana_api_key = aws_grafana_workspace_api_key.key.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}"

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

# prevents the module to create a workspace
enable_managed_prometheus = false

managed_prometheus_workspace_id = module.managed_service_prometheus.workspace_id
managed_prometheus_workspace_endpoint = module.managed_service_prometheus.workspace_prometheus_endpoint
managed_prometheus_workspace_region = var.cluster_one.region
managed_prometheus_cross_account_role = aws_iam_role.cross_account_amp_role.arn
irsa_iam_additional_policies = [aws_iam_policy.irsa_assume_role_policy_one.arn]

Expand All @@ -51,10 +55,6 @@ module "eks_monitoring_one" {
}

enable_logs = true

depends_on = [
module.aws_observability_accelerator
]
}


Expand All @@ -63,7 +63,7 @@ module "eks_monitoring_one" {
###########################################################################

module "eks_monitoring_two" {
source = "../../modules/eks-monitoring"
source = "../..//modules/eks-monitoring"
# source = "github.com/aws-observability/terraform-aws-observability-accelerator//modules/eks-monitoring?ref=v2.0.0"
providers = {
aws = aws.eks_cluster_two
Expand Down Expand Up @@ -91,11 +91,15 @@ module "eks_monitoring_two" {
grafana_api_key = aws_grafana_workspace_api_key.key.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}"

# prevents the module to create a workspace
enable_managed_prometheus = false

managed_prometheus_workspace_id = module.managed_service_prometheus.workspace_id
managed_prometheus_workspace_endpoint = module.managed_service_prometheus.workspace_prometheus_endpoint
managed_prometheus_workspace_region = var.cluster_two.region

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
managed_prometheus_cross_account_role = aws_iam_role.cross_account_amp_role.arn
irsa_iam_additional_policies = [aws_iam_policy.irsa_assume_role_policy_two.arn]

Expand All @@ -106,10 +110,6 @@ module "eks_monitoring_two" {
}

enable_logs = true

depends_on = [
module.aws_observability_accelerator
]
}

###########################################################################
Expand All @@ -133,17 +133,3 @@ module "managed_service_prometheus" {

workspace_alias = local.amp_workspace_alias
}

module "aws_observability_accelerator" {
source = "../../../terraform-aws-observability-accelerator"
aws_region = var.monitoring.region
enable_managed_prometheus = false
enable_alertmanager = false
managed_prometheus_workspace_region = var.monitoring.region
managed_prometheus_workspace_id = module.managed_service_prometheus.workspace_id
managed_grafana_workspace_id = var.monitoring.managed_grafana_id

providers = {
aws = aws.central_monitoring
}
}

0 comments on commit 1d5f4d6

Please sign in to comment.