-
Notifications
You must be signed in to change notification settings - Fork 677
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
Created wrapper function around GetOkExists and all GetOk function usage has been replaced with GetFieldExists wrapper function #5965
Conversation
resolved struct name changes from go-admin-sdk 0.3.0 to 0.4.4 upgrade
made code compliant with go fmt requirements
solving errors in struct type matching and string array conversion
added switch cases for hrefUrl
enabled toggle of feature to be set by user
…age has been replaced with GetFieldExists wrapper function
Issue of using GetOk function in terraform source codeParent: https://github.com/IBM-Cloud/terraform-provider-ibmHow GetOk function is being used in the plugin :-When user writes terraform code and runs it, terraform internally creates a instance of Struct of Schema.ResourceData where it stores attribute data in a map. Then it identifies the particular resource being used and sends the ResourceData to the particular CRUD function defined on that resource in provider.go file. Then the function wants to check what attributes are defined by user so they use the Implementation of GetOk function :-
Issue with GetOk function implementation :-If user sets attribute value to Zero value
Then GetOk function reports the attribute doesn't exists at all which is wrong behaviour and leads to issues like attribute being not present in resource during create time and also resource attribute value cannot be updated to the zero value Current work-aroundGetOkExists function can be used as replacement for GetOk function which gives correct behaviour, but it is deprecated Implementation of GetOkExists :-
|
Testing Terraform plugin on AppConfigurationProcedure:-
main.tf file
updated main.tf to check for updates
Using 1.75.0 latest releaseBefore
After
Using the binary built on this PRBefore
After
|
Community Note
Relates OR Closes #0000
Output from acceptance testing:
Output of
make build
Manual testing
Go code test file test runs