-
Notifications
You must be signed in to change notification settings - Fork 325
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
keycloak_realm : custom attributes are not imported with terraform import command #592
Comments
I was able to reproduce this issue myself. I tried your suggestion locally, but it presents other problems, like a non-empty plan following an apply operation (which automatically causes tests to fail). The issue with the I spent some time trying to find a good compromise with no luck. I think it might be possible to treat this field similarly to the @tomrutsaert do you have any thoughts on this? |
Thanks for the comment @mrparkers We also have discussed about this problem between our team members and also think that it may be easier to manage custom attributes with extra_config as you suggest. It makes sense to be able to distinguish attributes used by keycloak for internal features from pure custom attributes. We can try to make a PR like #579 and following ones you have made on other resources ? |
It is very annoying that keycloak has it own extra attributes derived form other config settings. As indicated by @mrparkers , this makes the whole attributes lifecycle way more complex. Is there any harm to import all realm attributes initially? As indicated in opening post? (I typed this comment without looking at the code, so I could be missing something) |
Hi,
Expected Behavior
Can import existing realm attributes with resource
keycloak_realm
Current Behavior
Existing realm attributes are not imported with the
import
command ofkeycloak_realm
Steps to Reproduce
Have an existing
test
realm with some custom attributes.Try to import this realm :
Attributes are not imported with import command.
terraform.tfstate
content with emptyattributes
:So, terraform apply suggest to create these attributes :
Context (Environment)
We are doing retro-engineering on actual configuration to provision everything with this provider
Tested with latest version 3.3.0
Possible Solution
Problem seems to be here :
https://github.com/mrparkers/terraform-provider-keycloak/blob/cb74346df6c3e4bb4e2696824d60b65932a1bea3/provider/resource_keycloak_realm.go#L1144
as
data.GetOk("attributes")
will always be empty when running initialimport
commandImport works fine by replacing
by
but I was wondering about the above comment mentioning duplicates values ? @mrparkers ?
After another
import
, tfstate is ok :The text was updated successfully, but these errors were encountered: