-
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
Add New Resource & Data Source: azurerm_netapp_volume #4933
Add New Resource & Data Source: azurerm_netapp_volume #4933
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 this is off to a good start - there's a few bits of the schema which need to be updated (in particular the allowed_clients
field), but if we can fix up the comments then we should be able to run the tests and take another look :)
Thanks!
azurerm/data_source_netapp_volume.go
Outdated
Computed: true, | ||
}, | ||
|
||
"export_policy_rule": { |
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 can remove this field - since I don't think it's likely to be used by users?
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 don't think so. Now both powershell and azure portal for netapp volume have opened this entry to let user edit export policy. And we cannot ensure the users won't use this, right? If they want to use, then I need to submit another PR for this? I think it's not a good option,right? So why don't we leave it as optional field? And this field should be optional after checked official doc https://docs.microsoft.com/en-us/azure/azure-netapp-files/azure-netapp-files-configure-export-policy.
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.
whilst users may configure this on the Resource, the Data Source is Read Only and I can't envisage a scenario where users are likely to use this in the Data Source (since this needs to be a Set too) - for now let's remove it and we can add it back in if users request it
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.
removed
}, | ||
|
||
"export_policy_rule": { | ||
Type: schema.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.
since the rule_index is part of this presumably these could be returned in any order and export_policy_rule
needs to become a 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.
I found other field *_rule also is set as TypeList in existing resources of terraform. So I also can set this field as TypeList like others, right? I think even if these could be returned in any order, but I think it doesn't mean it must be set as TypeSet, right? For more details about rule_index and export_policy, please see this doc https://docs.microsoft.com/en-us/azure/azure-netapp-files/azure-netapp-files-configure-export-policy
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.
Most of those should probably be TypeSets
too, as order doesn't matter if rule_index
is used, otherwise if we keep it as a typelist the ordering could be implicitly inferred by the index. WDYT @tombuildsstuff ?
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
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 this is off to a good start - there's a few bits of the schema which need to be updated (in particular the allowed_clients
field), but if we can fix up the comments then we should be able to run the tests and take another look :)
Thanks!
(sorry for the double-review, Github returned a 500 🙃) |
@tombuildsstuff , Thanks for your comments. I've updated code per your 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.
thanks for the revisions @neil-yechenwei, i've left some more comments inline
}, | ||
|
||
"export_policy_rule": { | ||
Type: schema.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.
Most of those should probably be TypeSets
too, as order doesn't matter if rule_index
is used, otherwise if we keep it as a typelist the ordering could be implicitly inferred by the index. WDYT @tombuildsstuff ?
@katbyte , Thanks for your comments. I've updated code per your 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.
Thanks for the revisions @neil-yechenwei, i've left a couple of additional minor comments inline
ValidateFunc: validation.IntBetween(1, 5), | ||
}, | ||
"allowed_clients": { | ||
Type: schema.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.
This should probably be a set 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.
Fixed
|
||
* `location` - The Azure Region where the NetApp Volume exists. | ||
|
||
* `creation_token` - A unique file path for 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.
Could we use data source language 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
|
||
* `rule_index` - (Required) The index number of the rule. | ||
|
||
* `allowed_clients` - (Required) Client ingress specification as list with IPv4 CIDRs, IPv4 host addresses. |
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 fix the grammar 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
|
||
* `service_level` - (Required) The service level of the file system. Valid values include `Premium`, `Standard`, or `Ultra`. | ||
|
||
* `subnet_id` - (Required) The ID of a Subnet in which the NetApp Volume, which must have the delegation Microsoft.NetApp/volumes. Changing this forces a new resource to be created. |
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 fix the grammar 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
|
||
* `creation_token` - (Required) A unique file path for the volume. Used when creating mount targets. | ||
|
||
* `service_level` - (Required) The service level of the file system. Valid values include `Premium`, `Standard`, or `Ultra`. |
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 elaborate on what the service level means?
Thanks for the comments @katbyte , I've created a new issue on azure-sdk-for-go for this API and updated the code per your 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.
Thank you for the revisions @neil-yechenwei, I've left some more comments inline that should be addressed before merge.
d.Set("subnet_id", props.SubnetID) | ||
|
||
if props.UsageThreshold != nil { | ||
d.Set("usage_threshold", *props.UsageThreshold/1073741824) |
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.
what units is usage_threshold
in? could we make the name usage_threshold_in_units
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 am confused. You want this field name is updated to "usage_threshold_in_units" or "storage_quota_in_gb"? I think "storage_quota_in_gb" as you suggested below is preferred so that I updated this field name to "storage_quota_in_gb".
|
||
* `account_name` - (Required) The name of the NetApp account in which the NetApp Pool should be created. Changing this forces a new resource to be created. | ||
|
||
* `creation_token` - (Required) A unique file path for the volume. Used when creating mount targets. Changing this forces a new resource to be created. |
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 this perhaps be called something different? creation token seems odd if its more the "volume path"?
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
Thank you for the comments @katbyte , I've updated code per your 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.
Thanks for the revisions @neil-yechenwei,
In addition to the comments i've left inline some tests are failing:
------- Stdout: -------
=== RUN TestAccAzureRMNetAppVolume_complete
=== PAUSE TestAccAzureRMNetAppVolume_complete
=== CONT TestAccAzureRMNetAppVolume_complete
--- FAIL: TestAccAzureRMNetAppVolume_complete (899.77s)
testing.go:569: Step 0 error: errors during apply:
Error: Error waiting for creation of NetApp Volume "acctest-NetAppVolume-191211182103728355" (Resource Group "acctestRG-netapp-191211182103728355"): Code="InternalServerError" Message="Error calling V1CreateIPRange: {\"code\":null,\"message\":\"Error creating IP range - Specified IP range clashes with an existing IP range\"}\n"
Error: Error waiting for creation of NetApp Volume "acctest-NetAppVolume-191211182103680430" (Resource Group "acctestRG-netapp-191211182103680430"): Code="InternalServerError" Message="The requested FileSystemAllocation was not found."
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.
there are still some issues that need to be addressed and multiple tests are failing:
------- Stdout: -------
=== RUN TestAccAzureRMNetAppVolume_updateSubnet
=== PAUSE TestAccAzureRMNetAppVolume_updateSubnet
=== CONT TestAccAzureRMNetAppVolume_updateSubnet
--- FAIL: TestAccAzureRMNetAppVolume_updateSubnet (167.89s)
testing.go:569: Step 0 error: errors during apply:
Error: Error waiting for creation of NetApp Volume "acctest-NetAppVolume-191212172909800478" (Resource Group "acctestRG-netapp-191212172909800478"): Code="InternalServerError" Message="Error calling V1CreateIPRange: {\"code\":null,\"message\":\"Error creating IP range - Specified IP range clashes with an existing IP range\"}\n"
i suggest running all tests in parallel
@katbyte , I already used the command you provided before for testing. Below is my test result whose test cases are all passed. I am using the test command --- PASS: TestAccAzureRMNetAppVolume_complete (571.17s) |
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 the revisions @neil-yechenwei, tests pass and this LGTM now!
This has been released in version 1.40.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 = "~> 1.40.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 👉 hashibot-feedback@hashicorp.com. Thanks! |
This PR is code implement for issue #3936
Fixes #3936