fluxcd / notification-controller

The GitOps Toolkit event forwarded and notification dispatcher

Home Page:https://fluxcd.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Enable Terraform resource monitoring

sergiogarciarodriguez opened this issue · comments

Currently there is no support for tf-contoller resources notifications, I didn't find any way to make notification-contoller work along tf-controller with current configuration but adding Terraform into notification-contoller CRDs make it work.

{"level":"info","ts":"2023-03-28T07:46:29.549Z","logger":"event-server","msg":"Discarding event, no alerts found for the involved object","reconciler kind":"Terraform","name":"usw2-blue-cluster","namespace":"test-alert-aws-global-dev"}

Adding Terraform to eventSources into alerts, providers and receivers CRDs (

) makes possible to create alerts with kind Terraform like the following able to filter and notify properly:

kind: Alert
metadata:
  name: terraform-alert
  namespace: flux-system
spec:
  providerRef:
    name: slack
  eventSeverity: error
  eventSources:
  - kind: Terraform
    name: "*"
    namespace: "test-alert-aws-global-dev"

Applying this alert event is filtered properly resulting in notification:

{"level":"info","ts":"2023-03-28T08:18:48.539Z","logger":"event-server","msg":"Dispatching event: Drift detected.\n\nChanges to Outputs:\n # Warning: this attribute value will be marked as sensitive and will not\n # display in UI output after applying this change.\n ~ kubeconfig = (sensitive value)\n\n\n","reconciler kind":"Terraform","name":"usw2-blue-cluster","namespace":"test-alert-aws-global-dev"}

image

Please, let me know if I'm doing something the wrong way. Thank you!

Thank you very much, I didn't notice that part of documentation. Should I include provider CRD patch? @stefanprodan