splunk / terraform-provider-splunk

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

fix(index, saved_searches): Refreshing Terraform state if resources are deleted outside of Terraform #151

Open raytung opened 1 year ago

raytung commented 1 year ago

Hey team,

This PR fixes a problem with the index and saved_searches resource if someone deleted them outside of Terraform. Instead of erroring out on Terraform plan / apply, it should recreate these resources.

anushjay commented 1 year ago

@raytung I don't think this scenario, which is caused by managing resources manually, should be handled within the provider. Can you not use the terraform rm state cmd to remove the resource from the tf config?

raytung commented 1 year ago

@anushjay In the ideal case, resources managed by Terraform shouldn't be managed manually, but in reality it's difficult to make that guarantee, especially in a tool like Splunk where it has a big exploratory component. In some cases, we need to allow Terraform to reconcile the state without having to manually running resource removal from Terraform states.

This problem is also mentioned in another issue https://github.com/splunk/terraform-provider-splunk/issues/86

jeffsanicola commented 1 year ago

This would greatly help in my situation. We have a centralized Terraform deployment process where state files are supported by a different team. Every time I run into an issue like this I need to open a case with our support team to have the element removed from state. Enabling such drift detection would eliminate the need for me to open cases while developing modules that leverage this provider.

raytung commented 9 months ago

Hey @anushjay, would love to get your second thoughts on this.