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

terraform fails if a managed resource is deleted in the splunk gui

Open dmoe86 opened this issue 3 years ago • 3 comments

if you create a role with this provider and then someone removes the role in the splunk web gui, the next run of terraform plan will fail with the error "unable to find resource" instead of recreating the resource.

dmoe86 avatar Aug 30 '21 20:08 dmoe86

I have noticed the same. The provider historically hasn't liked drift one bit (be it deletion or just out-of-band configuration changes).

I often work around this by logging into the system running terraform (not always a trivial task), performing a state rm (again, not always trivial, when resource addresses are potentially being dynamically populated), and re-run my code. It is probably possible to automate this, but it seems like Terraform is generally intended to be able to reconcile state on refresh, in spirit at least. I know that this is not a viable option in many situations; it's certainly neither elegant nor preferred.

jsworkaccount avatar Sep 02 '21 20:09 jsworkaccount

Yea, in my experience this is a provider maturity thing. Some providers will handle the 404 understanding that it means the object no longer exists and assume it needs to be created. Other providers simply treat the 404 as an error and pass it up the stack.

I'll be honest in that most Terraform admins I know know enough to use it, but messing with state is beyond their capability. If the provider can recognize that a 404 means the object was deleted and recreate it, that's the route I'd go...

JosephHobbs avatar Nov 24 '21 19:11 JosephHobbs

Im seeing this same issue but with apps that havent been installed yet, terraform will correctly handle apps that ive already installed or at least wont error with them but when it reaches ones that havent been installed itll throw a Unable to find resource:

wkleinhenz avatar Dec 09 '21 19:12 wkleinhenz