opensearch-project / terraform-provider-opensearch

https://registry.terraform.io/providers/opensearch-project/opensearch
Apache License 2.0
74 stars 57 forks source link

Fix persistent delete of config_id (88) #103

Open afrodidact opened 11 months ago

afrodidact commented 11 months ago

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.

prudhvigodithi commented 11 months ago

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

afrodidact commented 11 months ago

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.

prudhvigodithi commented 10 months ago

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

afrodidact commented 10 months ago

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