splunk / terraform-provider-splunk

Terraform Provider for Splunk
Mozilla Public License 2.0
103 stars 75 forks source link

Could not find object id while creating alerts #112

Open rajesh375 opened 2 years ago

rajesh375 commented 2 years ago

Plan: 2 to add, 0 to change, 0 to destroy.

While trying to create alert for the first time , i see this issue.

module.second_alert.splunk_saved_searches.email_alert_5m: Creating... module.first_alert.splunk_saved_searches.email_alert_5m: Creating... module.second_alert.splunk_saved_searches.email_alert_5m: Still creating... [10s elapsed] module.first_alert.splunk_saved_searches.email_alert_5m: Still creating... [10s elapsed] ╷ │ Error: Could not find object id=terraform-1 │ │ with module.second_alert.splunk_saved_searches.email_alert_5m, │ on alerts/email_5m/main.tf line 9, in resource "splunk_saved_searches" "email_alert_5m": │ 9: resource "splunk_saved_searches" "email_alert_5m" {

rajesh375 commented 2 years ago

I deleted state files and tried recreating it but still the results are same

Aeternax commented 2 years ago

+1

Same issue on provider version v1.4.12 when trying to add a splunk_saved_searches. Splunk Enterprise Version 8.2.1

Error: Could not find object id=jira - Error retrieving gadget spec found
  on splunk.tf line 25, in resource "splunk_saved_searches" "error_retrieving_gadget_spec":
  25: resource "splunk_saved_searches" "error_retrieving_gadget_spec" {

The problem I ran into was that the search itself was broken due to a missing double-quote. But this error was not handled by the provider, so it adds it to the TF state regardless. Then it fails to look it up when you run a plan or apply afterwards.