mrparkers / terraform-provider-keycloak

Terraform provider for Keycloak
https://registry.terraform.io/providers/mrparkers/keycloak/latest/docs
MIT License
612 stars 300 forks source link

Error binding multiple auth flow at the same time #801

Open max-petrovich opened 1 year ago

max-petrovich commented 1 year ago

If I try to bind multiple threads at the same time (in one execution of apply) - I get the following error. If you repeatedly execute apply, one binding is applied each time, and as a result, the plan will be executed.

Error: error sending PUT request to /auth/admin/realms/users: 400 Bad Request. Response body:

{"errorMessage":"javax.persistence.OptimisticLockException: Batch update returned unexpected row count from update [0]; actual row count: 0; expected: 1; statement executed: delete from REALM_ATTRIBUTE where NAME=? and REALM_ID=?"}

with keycloak_authentication_bindings.users_registration_flow_binding,
on main.tf line 344, in resource "keycloak_authentication_bindings" "users_registration_flow_binding":
344: resource "keycloak_authentication_bindings" "users_registration_flow_binding" {
max-petrovich commented 1 year ago

Reproduced only if keycloak_authentication_bindings are specified multiple times

If i run terraform apply -parallelism=1 - there will be no error.