-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
azurerm_redis_cache - support access_keys_authentication_disabled property #27039
azurerm_redis_cache - support access_keys_authentication_disabled property #27039
Conversation
199cea6
to
5201b0a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this PR!
I have left some additional mostly minor comments that once addressed this should be good to merge 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some minor comments, otherwise LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this PR @gerrytan. Please see the comment left in-line, the property will need to be renamed to conform to our naming guidelines. Once that's done and the logic amended we can take another look through.
Thanks @gerrytan, it LGTM now! |
Co-authored-by: magodo <[email protected]>
Co-authored-by: magodo <[email protected]>
Co-authored-by: magodo <[email protected]>
To comply with Hashicorp contrib guide
Co-authored-by: magodo <[email protected]>
faa348a
to
a68b456
Compare
@stephybun @magodo this PR is now good for review. All feedbacks have been addressed and acctests have been rerun successfully, check the output log on the description. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @gerrytan, other than the two minor comments left in-line this looks good. Once those are resolved this should be ready to go in!
accessKeyAuthEnabled := true | ||
if props.DisableAccessKeyAuthentication != nil { | ||
accessKeyAuthEnabled = !(*props.DisableAccessKeyAuthentication) | ||
} | ||
d.Set("access_keys_authentication_enabled", accessKeyAuthEnabled) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a common pattern in the provider to make use of pointer.From
when setting properties that are pointers into state. pointer.From
will nil check the input and if the pointer is nil will return the zero value for the type that was passed in, so this would be condensed down to:
accessKeyAuthEnabled := true | |
if props.DisableAccessKeyAuthentication != nil { | |
accessKeyAuthEnabled = !(*props.DisableAccessKeyAuthentication) | |
} | |
d.Set("access_keys_authentication_enabled", accessKeyAuthEnabled) | |
d.Set("access_keys_authentication_enabled", !pointer.From(props.DisableAccessKeyAuthentication)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@stephybun is right, I definitely missed this out.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah nice idea, thx @stephybun . I will alter the suggested code a bit: we want to make the expression defaults to true
if we get nil value on DisableAccessKeyAuthentication
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addressed in 50de57e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gerrytan that is the outcome of my suggestion above.
If props.DisableAccessKeyAuthentication
is nil
, pointer.From
will return false
(the zero value for bools) which will result in true
since it's being inverted. The variable initialization and nil check on lines 357-361 are redundant. Can you please apply the suggestion as made?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@stephybun ah I get it now. Fixed in 5341f2f.
accessKeyAuthEnabled := true | ||
if props.DisableAccessKeyAuthentication != nil { | ||
accessKeyAuthEnabled = !(*props.DisableAccessKeyAuthentication) | ||
} | ||
d.Set("access_keys_authentication_enabled", accessKeyAuthEnabled) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
accessKeyAuthEnabled := true | |
if props.DisableAccessKeyAuthentication != nil { | |
accessKeyAuthEnabled = !(*props.DisableAccessKeyAuthentication) | |
} | |
d.Set("access_keys_authentication_enabled", accessKeyAuthEnabled) | |
d.Set("access_keys_authentication_enabled", !pointer.From(props.DisableAccessKeyAuthentication)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addressed in 50de57e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 5341f2f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See responses to ongoing discussion in comments
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apologies if my initial explanation of the pointer.From
function wasn't clear, thanks for making those changes @gerrytan LGTM 🍎
I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active contributions. |
Community Note
Description
Adds support for
access_keys_authentication_disabled
property forazurerm_redis_cache
PR Checklist
For example: “
resource_name_here
- description of change e.g. adding propertynew_property_name_here
”Changes to existing Resource / Data Source
(For changes that include a state migration only). I have manually tested the migration path between relevant versions of the provider.Testing
make acctests SERVICE='redis' TESTARGS='-run=TestAccRedisCache_AccessKeysAuthenticationEnabledDisabled' TESTTIMEOUT='120m'
-output log
TestAccRedisCacheDataSource_standard
- output logChange Log
Below please provide what should go into the changelog (if anything) conforming to the Changelog Format documented here.
azurerm_redis_cache
- support foraccess_keys_authentication_disabled
property [Support for Microsoft.Cache for Redis API v2024-03-01 #26797]This is a (please select all that apply):
Related Issue(s)
Fixes #26797
Note
If this PR changes meaningfully during the course of review please update the title and description as required.