-
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
New Resource: azurerm_extended_location_custom_location
#24267
Conversation
jiaweitao001
commented
Dec 18, 2023
- All related tests passed.
e62b935
to
8fc0353
Compare
8fc0353
to
52cf42d
Compare
52cf42d
to
177625d
Compare
177625d
to
22f3a0c
Compare
22f3a0c
to
6dd7dab
Compare
6dd7dab
to
a8f490e
Compare
a8f490e
to
35070dc
Compare
internal/services/extendedlocation/extended_location_custom_location.go
Outdated
Show resolved
Hide resolved
internal/services/extendedlocation/extended_location_custom_location.go
Outdated
Show resolved
Hide resolved
internal/services/extendedlocation/extended_location_custom_location.go
Outdated
Show resolved
Hide resolved
}, | ||
|
||
"authentication": { | ||
Type: pluginsdk.TypeList, |
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.
Could we improve the validation 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.
Sure. Will contact service team's POC for requirements of this authentication.
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.
Similarly here, do we have validation information / acceptable values for the docs from the Service Team?
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.
value
now has a validation func, service team did not provide any info about type
.
cluster_extension_ids = [ | ||
"${azurerm_arc_kubernetes_cluster_extension.test.id}" | ||
] | ||
display_name = "customlocation%[2]d" |
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.
I think we don't need to specify display_name
in the basic config, because it's optional.
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.
Will remove.
), | ||
}, | ||
data.ImportStep(), | ||
}) |
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.
Could we add one more step to test whether the resource could be able to update to the basic config?
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.
Will do.
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.
This looks to have been missed?
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 not possible to update to basic
from update
in this case, because once display_name
is set here, it cannot be removed.
data.ImportStep(), | ||
}) | ||
} | ||
|
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.
Could we add one more testcase to test whether we could deploy the complete config directly instead of updating it from the basic config? And consider updating the config name from "update" to "complete"?
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.
Will fix.
resource_group_name = azurerm_resource_group.test.name | ||
location = azurerm_resource_group.test.location | ||
cluster_extension_ids = [ | ||
"${azurerm_arc_kubernetes_cluster_extension.test.id}" |
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.
Could we remove the "${}", please also update other places.
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.
Will do.
resource_group_name = azurerm_resource_group.example.name | ||
location = "West Europe" | ||
cluster_extension_ids = [ | ||
"${azurerm_arc_kubernetes_cluster_extension.test.id}" |
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.
Should it be "azurerm_arc_kubernetes_cluster_extension.example.id"?
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 but overall LGTM!
0f103d3
to
b44259b
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 @jiaweitao001 - Just a couple more items (I think some code went missing in the rebase?) and I think this is good to go. Testing is looking good at this stage, so if you can check the comments I think we can get this merged.
state.Namespace = pointer.From(props.Namespace) | ||
} | ||
|
||
if props.Authentication != nil && props.Authentication.Type != nil && props.Authentication.Value != nil { |
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.
This feels like a bug, if the property is optional in the spec and all of it's properties are null, this should be null too? Can you open an issue on the spec to track and add a comment here?
d := metadata.ResourceData | ||
|
||
if d.HasChanges("authentication") { | ||
if len(state.Authentication) > 0 { |
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.
We seem to have lost this change to remove the auth when empty as part of the rebase?
Properties: pointer.To(customLocationProps), | ||
} | ||
|
||
if _, err := client.Update(ctx, *id, props); err != nil { |
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.
The number of properties doesn't really matter, it's the behaviour of the API and compatibility with Terraform's expectations. So, if we have one or more properties that are allowed to be removed entirely, such as authentication
, we need to know how to unset those. If sending a nil
for a value doesn't remove/unset it (as per the HTTP spec, this should be a no-op) we need to send the appropriate value to remove it.
To the point of Update
vs CreateOrUpdate
, the "location is required" error will not happen if we use a Get
to retrieve the existing data, then simply update that with any user changes before sending it back, rather than using the Patch
only method?
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 @jiaweitao001 - I think this looks good to go now, thanks for the changes and the persistence 👍
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. |