Open tculp opened 1 year ago
I started with an implementation here: https://github.com/mrparkers/terraform-provider-keycloak/compare/master...mweibel:terraform-provider-keycloak:realm-import
I had issues with importing the master realm afterwards, a second apply would then yield a diff:
# module.test.keycloak_realm.master will be updated in-place
~ resource "keycloak_realm" "master" {
- default_signature_algorithm = "RS256" -> null
- display_name = "Keycloak" -> null
- display_name_html = "<div class=\"kc-logo-text\"><span>Keycloak</span></div>" -> null
id = "master"
# (44 unchanged attributes hidden)
# (3 unchanged blocks hidden)
}
not sure why exactly and didn't find out why before my self-allotted time run out. If anyone wants to continue from here feel free :)
PS: create a ~/.terraformrc
with dev_overrides pointing to your local clone to test this (make sure to run make build
, too).
now that terraform supports the import option natively, this feels redundant I was able to natively to do this:
import { id = "master" to = keycloak_realm.master }
The different an 'import' option would still have over the native terraform import is allowing destroys without deleting the realm
keycloak_client objects have an 'import' property, which allows one to configure various parameters of clients that were not created by terraform. This type of capability would be useful to have for realms too, especially for the sake of configuring options on the master realm.
This would also solve needs such as https://github.com/mrparkers/terraform-provider-keycloak/issues/597, without requiring the manual terraform import step and introducing a risk of accidentally deleting the master realm.