-
Notifications
You must be signed in to change notification settings - Fork 4.6k
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_netapp_volume - support mount_ip_addresses #5526
Conversation
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've taken a look through and left some comments inline but the main question I've got is regarding the resource design, if we can clarify that then we should be able to determine how to proceed here.
Thanks!
for _, item := range input.([]interface{}) { | ||
if item != nil { | ||
v := item.(map[string]interface{}) | ||
ipAddress := v["ipAddress"] |
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 needs to be:
ipAddress := v["ipAddress"] | |
ipAddress := v["ip_address"].(string) |
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 cannot be updated to "ip_address" since api returns ""mountTargets":[{"provisioningState":"Succeeded","ipAddress":"10.0.2.4"}]" for property mountTargets.
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 so this nested object isn't modelled as an object in the Swagger? in which case can we send a PR to the Swagger repo to fix that
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.
When it comes to mountTargets
, it reminds me that I changed that some time ago... and it may be a mistake. I will take a look at this and see how to change it correctly (and when changing the swagger we should let the service team know and approve, which may take a long time).
@@ -42,6 +42,19 @@ func dataSourceArmNetAppVolume() *schema.Resource { | |||
ValidateFunc: ValidateNetAppPoolName, | |||
}, | |||
|
|||
"mount_targets": { | |||
Type: schema.TypeSet, |
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 needs to be a TypeList if it's a Computed field else it's not easily indexable - however - what are the mount targets here, a list of IP Addresses which should be used to mount the volume? If so it's likely this'd make more sense as a list of strings being mount_ip_addresses
?
can we also update the test to confirm this field is correctly set
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
Hi @tombuildsstuff , Thanks for your comments. I've updated code. |
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.
hey @neil-yechenwei
Thanks for making those changes - taking a look through whilst this looks good it appears we also need to send a PR to fix the Swagger prior to merging this, else breaking changes to the API Response won't be caught via the ARM "breaking changes" process - would you be able to send a PR to fix that in the Swagger and link that in the code here so that we can switch it out once fixed?
Thanks!
@@ -43,6 +43,8 @@ The following attributes are exported: | |||
|
|||
* `location` - The Azure Region where the NetApp Volume exists. | |||
|
|||
* `mount_ip_addresses` - A list of IPv4 Addresses which should be used to mount the volume. |
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 has also been added to the Resource - so can we document this field there too?
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 didn't add this field "mount_ip_addresses" to the resource file. I just added this to data source file. So I think we don't need to document this field to resource md file.
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.
Is there a reason we are only adding it to the datasource and not the resource too? @neil-yechenwei
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.
You can find user's usage preference from (#5416), seems they want to use data source to retrieve this property value.
@tombuildsstuff , I am not sure what you mean. Do you mean I need to make a fix to set property type of MountTargets as exact data type not interface{} like ExportPolicy in the Swagger, right? If not, may I know what & why I need to fix in the swagger? |
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.
Yes that is correct, what tom is referring to is that the MountTargets
property is an interface without type
// MountTargets - List of mount targets
MountTargets interface{} `json:"mountTargets,omitempty"`
when it should be a fully typed array
// MountTargets - List of mount targets
MountTargets *[]VolumePropertiesMountTarget `json:"mountTargets,omitempty"`
@katbyte , If you point to this issue, I've confirmed with service owner. They will fix this issue in the future but no ETA. So I've added a comment in the code and filed an issue (Azure/azure-rest-api-specs#8604) on rest api spec. Once they fix this issue, I will make an another PR to update code. So could you help to merge this PR first? |
@katbyte & @tombuildsstuff , I've applied the fix for property mountTargets after new go sdk is upgraded. Thanks. |
@neil-yechenwei - could we add the property to the resource to? thanks! |
@katbyte , I also added it to resource. Thanks. |
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 @neil-yechenwei - LGTM 👍
This has been released in version 2.11.0 of the provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. As an example: provider "azurerm" {
version = "~> 2.11.0"
}
# ... other configuration ... |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 [email protected]. Thanks! |
Fixes #5416