Which attribute is causing this error when creating an Event Trigger using Terraform?

I’m using mongodbatlas_event_trigger from the mongodb/mongodbatlas Terraform provider to create a database trigger. I’ve already created a database trigger through the Atlas UI, and am now attempting to replicate that through Terraform, however I get the following error on apply:

Error: error creating MongoDB EventTriggers (62xxxxxxxxxxxxxxxxxxxx05): POST https://realm.mongodb.com/api/admin/v3.0/groups/62xxxxxxxxxxxxxxxxxxxx05/apps/63xxxxxxxxxxxxxxxxxxxx64/triggers: 400 (request “”) a database trigger requires an associated Atlas cluster service

My resource block is as follows:

resource "mongodbatlas_event_trigger" "client_full_name" {
  project_id                  = "62xxxxxxxxxxxxxxxxxxxx05"
  app_id                      = "63xxxxxxxxxxxxxxxxxxxx64"
  name                        = "clientFullName"
  type                        = "DATABASE"
  function_id                 = "63xxxxxxxxxxxxxxxxxxxx83"
  disabled                    = false
  config_operation_types      = ["INSERT", "UPDATE", "REPLACE"]
  config_database             = "Dev"
  config_collection           = "clients"
  config_service_id           = "62xxxxxxxxxxxxxxxxxxxxcf"
  config_full_document        = true
  config_full_document_before = false

Which value in the resource block would I have incorrect to be throwing that error?

(I use vars for values, they’re only hardcoded in the redacted example for debugging).

Found it - it was config_service_id. I was using the cluster_id output from cluster creation in Terraform - turns out it expects the id of the data link added to the application.

1 Like

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.