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

[auth flow] cyclic dependency with a realm => how to fix it simply ? need a dedicated resource ?

Open semangard opened this issue 3 years ago • 2 comments

Hello,

I do not see how to create with the same TF state :

  • an auth flow
  • and a realm using this auth flow

The auth flow expects a realm_id and the realm expects the flow_id ....

The example https://github.com/mrparkers/terraform-provider-keycloak/blob/master/example/main.tf does not give any clue, the only example is where an auth flow is assigned to a client... not a realm

What about creating a dedicated resource for example : keycloak_real_auth_flow to fix this simply ? Or do you have any simple workarround ?

semangard avatar Oct 24 '20 16:10 semangard

Yes, it is a missing feature. In current situation you need to do it in 2 steps

  1. create realm
  2. create flow and use a plain text reference to the flow on the realm

And Yes, the solution would be that the flow bindings on a realm are a separate tf resource. This has alreday been discussed somewhere in some other ticket as well. Please feel free to create a PR.

tomrutsaert avatar Oct 24 '20 18:10 tomrutsaert

This problem was mentioned in this issue. I've developed a separate resource but haven't had the time to submit the PR with tests and stuff. Meanwhile, you can either use the workaround provided in the ticket or do the job I didn't and submit the PR.

bruno-delfino1995 avatar Oct 25 '20 16:10 bruno-delfino1995