Skip to content

Commit

Permalink
Chore: Updates to integrations in outputs.tf and adding to COS HA mod…
Browse files Browse the repository at this point in the history
…ules
  • Loading branch information
MichaelThamm committed Oct 16, 2024
1 parent 2750ee8 commit 739d2de
Show file tree
Hide file tree
Showing 2 changed files with 113 additions and 18 deletions.
116 changes: 98 additions & 18 deletions terraform/modules/cos-ha/main.tf
Original file line number Diff line number Diff line change
@@ -1,15 +1,27 @@
module "catalogue" {
source = "git::https://github.com/canonical/catalogue-k8s-operator//terraform?ref=feature/terraform"
app_name = "catalogue"
model_name = var.model_name
channel = var.channel
}

module "grafana" {
source = "git::https://github.com/canonical/grafana-k8s-operator//terraform?ref=feature/terraform"
app_name = "grafana"
model_name = var.model_name
channel = var.channel
}

module "loki" {
source = "git::https://github.com/canonical/observability//terraform/modules/loki-ha?ref=cos-ha"
model_name = var.model_name
channel = var.channel
}

module "mimir" {
source = "../mimir-ha"
model_name = var.model_name
channel = var.channel
create_s3_integrator = false
source = "git::https://github.com/canonical/observability//terraform/modules/mimir-ha?ref=cos-ha"
model_name = var.model_name
channel = var.channel
}

module "ssc" {
Expand All @@ -19,33 +31,101 @@ module "ssc" {
channel = var.channel
}

# TODO: Replace s3_integrator resource to use its remote terraform module once available
resource "juju_application" "s3_integrator" {
name = "s3-integrator"
module "traefik" {
source = "git::https://github.com/canonical/traefik-k8s-operator//terraform?ref=feature/terraform"
app_name = "traefik"
model_name = var.model_name
channel = var.channel
}

# -------------- # Integrations --------------

# Provided by Loki

resource "juju_integration" "loki-grafana-dashboard" {
model = var.model_name
trust = true

charm {
name = "s3-integrator"
channel = var.channel
application {
name = module.loki.app_names["loki_coordinator"]
endpoint = module.loki.grafana_dashboard_endpoint
}
units = 1

application {
name = module.grafana.app_name
endpoint = module.grafana.grafana_dashboard_endpoint
}
}

# -------------- # Integrations --------------
resource "juju_integration" "loki-grafana-source" {
model = var.model_name

application {
name = module.loki.app_names["loki_coordinator"]
endpoint = module.loki.grafana_source_endpoint
}

application {
name = module.grafana.app_name
endpoint = module.grafana.grafana_source_endpoint
}
}

# Provided by Catalogue

resource "juju_integration" "grafana-catalogue" {
model = var.model_name

application {
name = module.catalogue.app_name
endpoint = module.catalogue.catalogue_endpoint
}

application {
name = module.grafana.app_name
endpoint = module.grafana.catalogue_endpoint
}
}

# Provided by Traefik

resource "juju_integration" "catalogue-ingress" {
model = var.model_name

application {
name = module.traefik.app_name
endpoint = module.traefik.ingress_endpoint
}

application {
name = module.catalogue.app_name
endpoint = module.catalogue.ingress_endpoint
}
}

resource "juju_integration" "grafana-ingress" {
model = var.model_name

application {
name = module.traefik.app_name
endpoint = module.traefik.traefik_route_endpoint
}

application {
name = module.grafana.app_name
endpoint = module.grafana.ingress_endpoint
}
}

resource "juju_integration" "coordinator_to_s3_integrator" {
resource "juju_integration" "loki-ingress" {
model = var.model_name

application {
name = juju_application.s3_integrator.name
endpoint = "s3-credentials"
name = module.traefik.app_name
endpoint = module.traefik.ingress_per_unit_endpoint
}

application {
name = module.mimir.app_names.mimir_coordinator
endpoint = "s3"
name = module.loki.app_names["loki_coordinator"]
endpoint = module.loki.ingress_endpoint
}
}
15 changes: 15 additions & 0 deletions terraform/modules/loki-ha/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,18 @@ output "app_names" {
}
)
}

output "grafana_dashboard_endpoint" {
description = "Forwards the built-in Grafana dashboard(s) for monitoring applications."
value = "grafana-dashboard"
}

output "grafana_source_endpoint" {
description = "Name of the endpoint used by apps to create a datasource in Grafana."
value = "grafana-source"
}

output "ingress_endpoint" {
description = "Name of the endpoint used by Loki to provide ingress."
value = "ingress"
}

0 comments on commit 739d2de

Please sign in to comment.