-
Notifications
You must be signed in to change notification settings - Fork 57
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
set default value for use_versioned_api param to true #555
Conversation
4e17ca6
to
19d6fca
Compare
I don't think this is the right approach. This will not be a good experience for customers. Can we write a custom diff method to suppress diff in some cases? |
@sumovishal Ideally we should not pass the value in cases where we don't want it. That is why we are using a bool pointer to have a tristate boolean property. I tried setting |
4f05c18
to
241d7ba
Compare
241d7ba
to
cbc2c78
Compare
@sumovishal I have added the custom diff method to suppress changes when needed. |
thanks, can you get it reviewed by someone from the Collection team? |
@sumovishal could you please force merge this as unrelated tests are failing? |
Currently, we do not have any default value for
use_versioned_api
parameter. The default value for the optional boolean in goLang isfalse
.Golang bool does not have a way to identify if the value was explicitly set or not . It is not able to identify the difference between if the value is set to
false
or the parameter is not set thereby taking default value asfalse
.When users are setting the parameter to
false
, it is not being passed to backend and therefore the resource is being created withuse_versioned_api
astrue
despite the config block havingfalse
.What we want is:
This PR converts the parameter to use a *bool and sets the default value as
true
and we are able to achieve the above behavior except for one caveat. Since the parameter has a default value oftrue
it gets passed in other path types as well, eg.CloudWatchPath
, where this parameter is not actionable, resulting in showing that the value needs to be changed when runningterraform plan
every time. Therefore, we have added a custom Diff method to suppress them when needed.Testing performed:
true
andfalse
values foruse_versioned_api
.use_versioned_api
and it takestrue
as default.ignore_changes
works for other S3-related resources to ignore any changes to this parameter.