terraform-provider-sumologic
terraform-provider-sumologic copied to clipboard
Inconsistent handling of `sumologic_content` on errors
Steps to reproduce
- Have a
sumologic_contentwith a dashboard definition with one of the panels mentioning a scheduled view which doesn't exist. - Run
terraform applyon 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
- (less important) clear error message
- (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
- Manually remove the dashboard from Sumo Logic UI
- Add the missing scheduled view
terraform apply
We are also facing same issue for sumologic_content (SavedSearchWithScheduleSyncDefinition). In our case, the alert never gets created in SumoLogic.
Have the same issue with referencing a lookup table that was not migrated to TF yet
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.
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.