Skip to content
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

Fix persistent delete of config_id (88) #103

Open
wants to merge 13 commits into
base: main
Choose a base branch
from

Conversation

afrodidact
Copy link

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
Copy link
Member

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

@afrodidact
Copy link
Author

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
Copy link
Member

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

@afrodidact
Copy link
Author

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

Aaron Miller and others added 6 commits November 7, 2023 00:52
* Add anomaly detection

Signed-off-by: Rupa Lahiri <[email protected]>

* Add test for update

Signed-off-by: Rupa Lahiri <[email protected]>

* Add audit config in anomaly detector test

Signed-off-by: Rupa Lahiri <[email protected]>

* Format terraform in test

Signed-off-by: Rupa Lahiri <[email protected]>

---------

Signed-off-by: Rupa Lahiri <[email protected]>
Signed-off-by: Aaron Miller <[email protected]>
opensearch-project#87)

* When the provider assumes a given role, don't use the default profile if the profile is not given, but allow aws-sdk-go to find the credentials using the default credential provider chain (opensearch-project#86)

Signed-off-by: Massimo Battestini <[email protected]>

* Adds unit tests for AWS profile change (opensearch-project#86)

Signed-off-by: Massimo Battestini <[email protected]>

---------

Signed-off-by: Massimo Battestini <[email protected]>
Signed-off-by: Aaron Miller <[email protected]>
…ct#114)

* Update template

Signed-off-by: Jason Parraga <[email protected]>

* Generate docs using tfplugindocs

Signed-off-by: Jason Parraga <[email protected]>

---------

Signed-off-by: Jason Parraga <[email protected]>
Signed-off-by: Aaron Miller <[email protected]>
@afrodidact afrodidact force-pushed the bugfix/opensearch-channel-configuration-config-id branch from b7e5dd1 to a747197 Compare November 7, 2023 00:53
* Add proxy support

Add a new optional parameter to the provider configuration to allow for
setting a proxy.  Using a proxy can be an easier method for connecting
to clusters within a VPC.

Signed-off-by: Tim Wisbauer <[email protected]>

* Add proxy support docs

Signed-off-by: Tim Wisbauer <[email protected]>

---------

Signed-off-by: Tim Wisbauer <[email protected]>
* Add anomaly detection

Signed-off-by: Rupa Lahiri <[email protected]>

* Add test for update

Signed-off-by: Rupa Lahiri <[email protected]>

* Add audit config in anomaly detector test

Signed-off-by: Rupa Lahiri <[email protected]>

* Format terraform in test

Signed-off-by: Rupa Lahiri <[email protected]>

---------

Signed-off-by: Rupa Lahiri <[email protected]>
opensearch-project#87)

* When the provider assumes a given role, don't use the default profile if the profile is not given, but allow aws-sdk-go to find the credentials using the default credential provider chain (opensearch-project#86)

Signed-off-by: Massimo Battestini <[email protected]>

* Adds unit tests for AWS profile change (opensearch-project#86)

Signed-off-by: Massimo Battestini <[email protected]>

---------

Signed-off-by: Massimo Battestini <[email protected]>
…ct#114)

* Update template

Signed-off-by: Jason Parraga <[email protected]>

* Generate docs using tfplugindocs

Signed-off-by: Jason Parraga <[email protected]>

---------

Signed-off-by: Jason Parraga <[email protected]>
* Add proxy support

Add a new optional parameter to the provider configuration to allow for
setting a proxy.  Using a proxy can be an easier method for connecting
to clusters within a VPC.

Signed-off-by: Tim Wisbauer <[email protected]>

* Add proxy support docs

Signed-off-by: Tim Wisbauer <[email protected]>

---------

Signed-off-by: Tim Wisbauer <[email protected]>
Signed-off-by: Aaron Miller <[email protected]>

Add anomaly detection (opensearch-project#105)

* Add anomaly detection

Signed-off-by: Rupa Lahiri <[email protected]>

* Add test for update

Signed-off-by: Rupa Lahiri <[email protected]>

* Add audit config in anomaly detector test

Signed-off-by: Rupa Lahiri <[email protected]>

* Format terraform in test

Signed-off-by: Rupa Lahiri <[email protected]>

---------

Signed-off-by: Rupa Lahiri <[email protected]>
Signed-off-by: Aaron Miller <[email protected]>

When the provider assumes a given role, don't use the default profile… (opensearch-project#87)

* When the provider assumes a given role, don't use the default profile if the profile is not given, but allow aws-sdk-go to find the credentials using the default credential provider chain (opensearch-project#86)

Signed-off-by: Massimo Battestini <[email protected]>

* Adds unit tests for AWS profile change (opensearch-project#86)

Signed-off-by: Massimo Battestini <[email protected]>

---------

Signed-off-by: Massimo Battestini <[email protected]>
Signed-off-by: Aaron Miller <[email protected]>

Add step to generate terraform provider documentation by running tfplugindocs (opensearch-project#120)

Signed-off-by: Rupa Lahiri <[email protected]>
Signed-off-by: Aaron Miller <[email protected]>

Improve documentation for HTTP basic authentication (opensearch-project#114)

* Update template

Signed-off-by: Jason Parraga <[email protected]>

* Generate docs using tfplugindocs

Signed-off-by: Jason Parraga <[email protected]>

---------

Signed-off-by: Jason Parraga <[email protected]>
Signed-off-by: Aaron Miller <[email protected]>

fix complaints in errcheck linter

Signed-off-by: Aaron Miller <[email protected]>

Add proxy support (opensearch-project#95)

* Add proxy support

Add a new optional parameter to the provider configuration to allow for
setting a proxy.  Using a proxy can be an easier method for connecting
to clusters within a VPC.

Signed-off-by: Tim Wisbauer <[email protected]>

* Add proxy support docs

Signed-off-by: Tim Wisbauer <[email protected]>

---------

Signed-off-by: Tim Wisbauer <[email protected]>

Add anomaly detection (opensearch-project#105)

* Add anomaly detection

Signed-off-by: Rupa Lahiri <[email protected]>

* Add test for update

Signed-off-by: Rupa Lahiri <[email protected]>

* Add audit config in anomaly detector test

Signed-off-by: Rupa Lahiri <[email protected]>

* Format terraform in test

Signed-off-by: Rupa Lahiri <[email protected]>

---------

Signed-off-by: Rupa Lahiri <[email protected]>

When the provider assumes a given role, don't use the default profile… (opensearch-project#87)

* When the provider assumes a given role, don't use the default profile if the profile is not given, but allow aws-sdk-go to find the credentials using the default credential provider chain (opensearch-project#86)

Signed-off-by: Massimo Battestini <[email protected]>

* Adds unit tests for AWS profile change (opensearch-project#86)

Signed-off-by: Massimo Battestini <[email protected]>

---------

Signed-off-by: Massimo Battestini <[email protected]>

Add step to generate terraform provider documentation by running tfplugindocs (opensearch-project#120)

Signed-off-by: Rupa Lahiri <[email protected]>

Improve documentation for HTTP basic authentication (opensearch-project#114)

* Update template

Signed-off-by: Jason Parraga <[email protected]>

* Generate docs using tfplugindocs

Signed-off-by: Jason Parraga <[email protected]>

---------

Signed-off-by: Jason Parraga <[email protected]>

Add proxy support (opensearch-project#95)

* Add proxy support

Add a new optional parameter to the provider configuration to allow for
setting a proxy.  Using a proxy can be an easier method for connecting
to clusters within a VPC.

Signed-off-by: Tim Wisbauer <[email protected]>

* Add proxy support docs

Signed-off-by: Tim Wisbauer <[email protected]>

---------

Signed-off-by: Tim Wisbauer <[email protected]>

Add anomaly detection (opensearch-project#105)

* Add anomaly detection

Signed-off-by: Rupa Lahiri <[email protected]>

* Add test for update

Signed-off-by: Rupa Lahiri <[email protected]>

* Add audit config in anomaly detector test

Signed-off-by: Rupa Lahiri <[email protected]>

* Format terraform in test

Signed-off-by: Rupa Lahiri <[email protected]>

---------

Signed-off-by: Rupa Lahiri <[email protected]>

Improve documentation for HTTP basic authentication (opensearch-project#114)

* Update template

Signed-off-by: Jason Parraga <[email protected]>

* Generate docs using tfplugindocs

Signed-off-by: Jason Parraga <[email protected]>

---------

Signed-off-by: Jason Parraga <[email protected]>

Add proxy support (opensearch-project#95)

* Add proxy support

Add a new optional parameter to the provider configuration to allow for
setting a proxy.  Using a proxy can be an easier method for connecting
to clusters within a VPC.

Signed-off-by: Tim Wisbauer <[email protected]>

* Add proxy support docs

Signed-off-by: Tim Wisbauer <[email protected]>

---------

Signed-off-by: Tim Wisbauer <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 📦 Backlog
Development

Successfully merging this pull request may close these issues.

6 participants