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

Fix persistent delete of config_id (88)

Open afrodidact opened this issue 1 year ago • 4 comments

Description

This change fixes a bug where the config_id attribute was lost during the plan/diff phase even after being set correctly in the Read method. I have now fixed the issue by extracting the config_id value from the API response to a temporary variable before setting the state. This avoids the issue caused by setting the state directly from the complex API response struct.

The fix ensures that the config_id property is correctly persisted in the resource state between plans. Additionally, I have included optional handling for the body attribute if defined in the schema to avoid hardcoding assumptions about the schema structure.

Issues Resolved

Closes [#88].

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license. For more information on following Developer Certificate of Origin and signing off your commits, please check here.

afrodidact avatar Oct 15 '23 02:10 afrodidact

Hey @afrodidact can you please add some tests for this change? Thank you

prudhvigodithi avatar Oct 16 '23 14:10 prudhvigodithi

Hi @prudhvigodithi, thanks for letting me know I missed the unit tests.

I haven't read that part of the code yet, so I will take some time over the coming days to familiarise myself with them, then alert you when I make my next commit.

afrodidact avatar Oct 17 '23 01:10 afrodidact

Hey @afrodidact can you please update the PR with some unit tests? we can proceed to merge this PR. Thanks

prudhvigodithi avatar Oct 27 '23 15:10 prudhvigodithi

Hi @prudhvigodithi, yes sorry for the delay. I am working on the unit tests and will try to update this soon.

afrodidact avatar Oct 27 '23 16:10 afrodidact