@@ -20,6 +20,61 @@ output "team_alerts_grafana_webhook_url" {
2020 sensitive = true
2121}
2222
23+ resource "discord_webhook" "yucca_alerts_grafana" {
24+ name = " Grafana"
25+ channel_id = discord_text_channel. yucca_alerts . id
26+ avatar_data_uri = local. image_data_uris [" grafana_128_128.webp" ]
27+ }
28+
29+ output "yucca_alerts_grafana_webhook_url" {
30+ value = discord_webhook. yucca_alerts_grafana . url
31+ sensitive = true
32+ }
33+
34+ resource "discord_webhook" "yucca_alerts_staging_grafana" {
35+ name = " Grafana Staging"
36+ channel_id = discord_text_channel. yucca_alerts_staging . id
37+ avatar_data_uri = local. image_data_uris [" grafana_128_128.webp" ]
38+ }
39+
40+ output "yucca_alerts_staging_grafana_webhook_url" {
41+ value = discord_webhook. yucca_alerts_staging_grafana . url
42+ sensitive = true
43+ }
44+
45+ # Publish each cluster's yucca-alerts Grafana webhook URL into its FUTO o11y vault
46+ # (o11y_tf_<env>) so the o11y stack can consume it. The o11y_tf_* vaults live in the
47+ # FUTO 1Password account, which the default (immich Connect) provider cannot reach —
48+ # hence provider = onepassword.futo.
49+ #
50+ # All three yucca-alerts channels live on the community server, which only the prod
51+ # discord apply manages — the dev apply targets the test server and would clobber the
52+ # vault items with test-server URLs on every run (its service account may not have o11y
53+ # vault access either, and data sources execute during every plan). Hence the for_each
54+ # collapses to an empty map outside prod.
55+ locals {
56+ o11y_grafana_discord_webhooks = {
57+ prod = discord_webhook.yucca_alerts_grafana.url
58+ staging = discord_webhook.yucca_alerts_staging_grafana.url
59+ dev = discord_webhook.yucca_alerts_dev_grafana.url
60+ }
61+ }
62+
63+ data "onepassword_vault" "o11y_tf" {
64+ for_each = { for env , url in local . o11y_grafana_discord_webhooks : env => url if var . env == " prod" }
65+ provider = onepassword. futo
66+ name = " o11y_tf_${ each . key } "
67+ }
68+
69+ resource "onepassword_item" "o11y_grafana_discord_webhook" {
70+ for_each = { for env , url in local . o11y_grafana_discord_webhooks : env => url if var . env == " prod" }
71+ provider = onepassword. futo
72+ vault = data. onepassword_vault . o11y_tf [each . key ]. uuid
73+ title = " GRAFANA_DISCORD_WEBHOOK"
74+ category = " password"
75+ password = each. value
76+ }
77+
2378resource "discord_webhook" "yucca_alerts_dev_grafana" {
2479 name = " Grafana Dev"
2580 channel_id = discord_text_channel. yucca_alerts_dev . id
0 commit comments