-
Notifications
You must be signed in to change notification settings - Fork 356
Open
Description
TL;DR:
-
Starting from Keycloak v22, GET-ing a realm with same access token used to create it, returns an incomplete 200 instead of 403.
- As was the case in v21 and prior
- Since provider acceptance test currently don't test v22 upwards, this has gone unnoticed so far
- This looks like a bug in Keycloak: # Realm GET after POST returns incomplete 200 response instead of 403 (starting from v22) keycloak#26301
-
Because of that, not receiving a
403
, the roken refresh is no longer triggered. This part (which explicitly mentions the 403 after realm create scenario): https://github.com/mrparkers/terraform-provider-keycloak/blob/master/keycloak/keycloak_client.go#L338 -
Since this behaviour change is present in Keycloak versions 22...23.0.4 it's probably needed to address this.
Having keycloak_default_roles
on a newly created realm causes a provider crash. If the realm already exists all works fine.
Sample code:
resource "keycloak_realm" "sample" {
realm = "tf_foo"
}
resource "keycloak_default_roles" "sample" {
# Commenting this out on first apply and all works fine on second apply after uncommenting.
realm_id = keycloak_realm.sample.id
default_roles = ["uma_authorization"]
}
Crash:
keycloak_default_roles.sample: Creating...
╷
│ Error: Plugin did not respond
│
│ with keycloak_default_roles.sample,
│ on main.tf line 47, in resource "keycloak_default_roles" "sample":
│ 47: resource "keycloak_default_roles" "sample" {
│
│ The plugin encountered an error, and failed to respond to the plugin.(*GRPCProvider).ApplyResourceChange call. The plugin logs may contain more details.
╵
Stack trace from the terraform-provider-keycloak_v4.3.1 plugin:
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x0 pc=0x102744754]
goroutine 11 [running]:
github.com/mrparkers/terraform-provider-keycloak/provider.resourceKeycloakDefaultRolesReconcile({0x102ac1808, 0x140003b3560}, 0x0?, {0x102ab3140?, 0x14000380a20?})
github.com/mrparkers/terraform-provider-keycloak/provider/resource_keycloak_default_roles.go:106 +0x174
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).create(0x140003a7260, {0x102ac1840, 0x1400032d5f0}, 0xd?, {0x102ab3140, 0x14000380a20})
github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/resource.go:707 +0xe8
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).Apply(0x140003a7260, {0x102ac1840, 0x1400032d5f0}, 0x1400019d2b0, 0x1400017f400, {0x102ab3140, 0x14000380a20})
github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/resource.go:837 +0x86c
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).ApplyResourceChange(0x140003841b0, {0x102ac1840?, 0x1400032d4d0?}, 0x140005b5e00)
github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/grpc_provider.go:1021 +0xb70
github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server.(*server).ApplyResourceChange(0x140001225a0, {0x102ac1840?, 0x1400032cc60?}, 0x14000636850)
github.com/hashicorp/[email protected]/tfprotov5/tf5server/server.go:818 +0x3b8
github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_ApplyResourceChange_Handler({0x102a84000?, 0x140001225a0}, {0x102ac1840, 0x1400032cc60}, 0x140006367e0, 0x0)
github.com/hashicorp/[email protected]/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:385 +0x170
google.golang.org/grpc.(*Server).processUnaryRPC(0x14000510000, {0x102ac53a0, 0x14000340820}, 0x1400039f680, 0x140000a6900, 0x102fbeb40, 0x0)
google.golang.org/[email protected]/server.go:1340 +0xb7c
google.golang.org/grpc.(*Server).handleStream(0x14000510000, {0x102ac53a0, 0x14000340820}, 0x1400039f680, 0x0)
google.golang.org/[email protected]/server.go:1713 +0x82c
google.golang.org/grpc.(*Server).serveStreams.func1.2()
google.golang.org/[email protected]/server.go:965 +0x84
created by google.golang.org/grpc.(*Server).serveStreams.func1
google.golang.org/[email protected]/server.go:963 +0x290
Error: The terraform-provider-keycloak_v4.3.1 plugin crashed!
This is always indicative of a bug within the plugin. It would be immensely
helpful if you could report the crash with the plugin's maintainers so that it
can be fixed. The output above should help diagnose the issue.
Metadata
Metadata
Assignees
Labels
No labels