-
Notifications
You must be signed in to change notification settings - Fork 21
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
BIOS update is not idempotent #19
Comments
I have actually found a way to deal with this but not sure if this is the intended way to use the provider:
|
Hi @brutus333 , Thank you very much for your feedback, really appreciate it. Currently Terraform has a limitation in terms of handling big maps on the state file. Not sure if you're familiar with Terraform development, but either way I'll explain. When you create a BIOS resource, in the state file (if I don't remember wrong) we actually save the whole BIOS attributes. In your .TF file there are only defined the ones you wish to modify. We could change the behavior to make it moreless idempotent following this. Rather than saving the whole list of BIOS attributes, just save the ones you want to modify. That would make Terraform not to trigger an update every time. The thing is, as soon as you add or remove any attribute, an update will be triggered, since .TF file resource and state file one won't match. What do you think? When you create a resource, an entry for that resource is created in the state file. |
I looked a bit through the documentation and other providers code and it seems that customdiffs is the way to go: https://www.terraform.io/docs/extend/resources/customizing-differences.html I'm sure that other providers are able to deal with partial configuration (I can't recall an example now) so it should be a way to fix this. On the other hand, I have to say that I don't have experience with writing TF providers, but I can try to contribute to this one. |
Hey @brutus333 , Let me take a look into that and I'll see what can be done there :). I'll keep this thread open to update when a fix has been implemented. We are also going to reach out Hashicorp to see if we can overcome that with the info you provided. About contributing, we are open to that, so you'll be more than welcome 😄 |
@brutus333, this is an excellent workaround. I am taking a look to see how the custom diff could be implemented for the Bios attributes. In the meantime, I will add your workaround to the example plans. |
@anupamaloke heads up - I'm working on some optimizations for it. My in progress branch is here: https://github.com/grantcurell/terraform-provider-redfish/tree/18-wait-for-bios-update-job-to-finish |
@grantcurell don't spend much time on this as I think Anupam had sorted it out already using a custom diff function. Let's sync up tomorrow! |
@mikeletux it took me a bit to catch up but I just realized what @brutus333 was talking about and why it's happening. Agreed, yes, using a custom diff makes sense to me. |
Community Note
Terraform CLI and Terraform Redfish Provider Version
Server(s) details and firmware version
PowerEdge R640
iDRAC 9 version 4.20.20.20
Affected Resource(s)
redfish_bios
Terraform Configuration Files
Debug Output
https://gist.github.com/brutus333/950a67e89c0a099356060af3a4ea4f2e
Panic Output
Expected Behavior
Once the configuration is updated TF should not try to change the resource again
Actual Behavior
Terraform tried to update the resource again (even if it was compliant with the definition), so the change is not idempotent as it should be.
Steps to Reproduce
terraform apply
Important Factoids
References
The text was updated successfully, but these errors were encountered: