Commit 472e85b
committed
Do not clear resources from the state based on NotFound errors
We encountered an issue where the database was unavailable while running
the Terraform Zitadel provider with an `action` resource.
After some debugging we found that Zitadel itself returned an error, but
it looks like the middleware (potentially as obfuscation strategy)
converts the error into a `NotFound` error:
https://github.com/zitadel/zitadel/blob/main/internal/api/grpc/server/middleware/instance_interceptor.go#L92-L111
So considering this behavior in the Zitadel API it seem to be a bug to
depend on the error code to determine if the resource should be removed
from the state.
In our case it caused the resource to be removed while it actually did
exist. So trying to run another `terraform apply` when the database was
running again, caused errors like:
```
Error: failed to create action: rpc error: code = AlreadyExists desc =
Errors.Action.AlreadyExists (V3-DKcYh)
```
Note that resetting/clearning the ID is still done at the end of this
function, unless there is exactly 1 result. So functionally that didn't
change.1 parent 5395c96 commit 472e85b
1 file changed
+0
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
120 | 120 | | |
121 | 121 | | |
122 | 122 | | |
123 | | - | |
124 | | - | |
125 | | - | |
126 | | - | |
127 | 123 | | |
128 | 124 | | |
129 | 125 | | |
| |||
0 commit comments