terraform-provider-sumologic icon indicating copy to clipboard operation
terraform-provider-sumologic copied to clipboard

Inconsistent handling of `sumologic_content` on errors

Open mccartney opened this issue 3 years ago • 4 comments

Steps to reproduce

  1. Have a sumologic_content with a dashboard definition with one of the panels mentioning a scheduled view which doesn't exist.
  2. Run terraform apply on it

Observed

First of all, the error message is uninformative:

Error: Failed - {content1:internal_error Unexpected error }

But more importantly:

  • the dashboard gets created
  • but the Terraform state doesn't register that dashboard.

Thus any subsequent terraform apply fails with:

Failed - {content1:duplicate_element Content:: Content with same name already exists. Name = REDACTED & Existing Parent ID = REDACTED }

Expected

  1. (less important) clear error message
  2. (more important) consistent handling of errors
  • either the "failing" dashboard should not trigger any Terraform error and go into the Terraform state
  • or it should not be created in Sumo Logic, if a Terraform error is triggered

Workaround / How to deal with the situation

  1. Manually remove the dashboard from Sumo Logic UI
  2. Add the missing scheduled view
  3. terraform apply

mccartney avatar Dec 16 '21 14:12 mccartney

We are also facing same issue for sumologic_content (SavedSearchWithScheduleSyncDefinition). In our case, the alert never gets created in SumoLogic.

vivekjainx86 avatar Nov 24 '22 06:11 vivekjainx86

Have the same issue with referencing a lookup table that was not migrated to TF yet

filip-daca avatar Feb 01 '23 14:02 filip-daca

Have the same issue with referencing a lookup table that was not migrated to TF yet

That alone shouldn't cause troubles. sumologic_content doesn't care (or even know) what is defined in TF and what is not. As long as the lookup table exists, it should be enough.

mccartney avatar Feb 01 '23 16:02 mccartney

I encountered the same error message. In my case the content was not getting updated in Sumologic. I was finally able to see a more detailed error message in Sumologic web UI by trying to edit the query (clicking the 3 dots). When saving the changes, I was getting this error:

Invalid Webhook Payload: Payload must be a valid JSON. control char (10) in string got ' ...' (line 2, column 239)

It appears SumoLogic API got more strict when it comes to the webhook payload. Using jsonencode for the searchSchedule.notification.payload value fixed the issue for me.

fallard84 avatar Mar 16 '23 00:03 fallard84