-
Notifications
You must be signed in to change notification settings - Fork 9
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
[Enhancement]: Add SVM storage_limit
parameter
#328
base: integration/main
Are you sure you want to change the base?
[Enhancement]: Add SVM storage_limit
parameter
#328
Conversation
@acch before we can accept this we need you to follow this (https://github.com/NetApp/terraform-provider-netapp-ontap/blob/integration/main/CONTRIBUTING.md). I think the only steps missing right now is step 5. |
@carchi8py I had signed the NetApp CCLA on Oct 16... please let me know what's missing. |
@acch thank i have that now. Look like the email group we were using was not accepting External email so we didn't get a copy. We've fix that and have your CCLA. |
We have a major version 2.0 that in the final stages of our legal review. We will be adding this in to our 2.1 release which will be the release after that one. |
Signed-off-by: Achim Christ <achim.christ@sva.de>
Signed-off-by: Achim Christ <achim.christ@sva.de>
Signed-off-by: Achim Christ <achim.christ@sva.de>
Signed-off-by: Achim Christ <achim.christ@sva.de>
Signed-off-by: Achim Christ <achim.christ@sva.de>
Signed-off-by: Achim Christ <achim.christ@sva.de>
2fcb74a
to
b576f5f
Compare
@acch Happy Holidays, just a head up we will be reviewing this shorting. Sorry for the hold up we were waiting on Security to finish their review of 2.0 before releasing it and that ended up taking significantly longer than we had hope. Now that, that out of the way we are starting to merge thing in again. Right now I'm working on getting all the dependencies updated and then we'll start review these. Probably will have review the first week of Jan (or end of this week if I have time). |
Happy Holidays @carchi8py! Thanks for the update. Please let me know what I can do to help. Thanks much for all your efforts — enjoy a few days off! 🎄 |
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.
Please update doc and add version check.
Signed-off-by: Achim Christ <achim.christ@sva.de>
Hello @chuyich, thank you very much for reviewing this PR. I have updated the docs and added cluster version checks to Thanks much! |
Signed-off-by: Achim Christ <achim.christ@sva.de>
19f6f0b
to
4880190
Compare
@@ -13,6 +13,7 @@ Retrieves the configuration of SVM | |||
## Supported Platforms | |||
|
|||
* On-prem ONTAP system 9.6 or higher | |||
* `storage_limit` attribute supported with ONTAP system 9.13 or higher |
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 added in the list of attributes on line 37-46
@@ -13,6 +13,7 @@ Retrieves the configuration of SVMs. | |||
## Supported Platforms | |||
|
|||
* On-prem ONTAP system 9.6 or higher | |||
* `storage_limit` attribute supported with ONTAP system 9.13 or higher |
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 added in the list of attributes on line 64-72
@@ -21,11 +21,12 @@ Create/Modify/Delete a SVM | |||
## Supported Platforms | |||
|
|||
* On-prem ONTAP system 9.6 or higher | |||
* `storage_limit` attribute supported with ONTAP system 9.13 or higher |
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 added in the list of attributes on line 47-63
MarkdownDescription: "Maximum storage permitted on svm, in bytes", | ||
Optional: true, | ||
Computed: true, | ||
Default: int64default.StaticInt64(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.
It is an optional parameter based on the API doc https://docs.netapp.com/us-en/ontap-restapi-9131/ontap/post-svm-svms.html#recommended-optional-properties
The default value is not needed.
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.
Without a default value, the attribute remains "unknown" after the apply - resulting in the following error:
╷
│ Error: Provider returned invalid result object after apply
│
│ After the apply operation, the provider still indicated an unknown value for netapp-ontap_svm.example.storage_limit. All values must be known after apply, so this is
│ always a bug in the provider and should be reported in the provider's own repository. Terraform will still save the other known object values in the state.
╵
I could manually set the value to 0 in internal/provider/svm/svm_resource.go > Create()
, but isn't a default value in the schema definition easier to read & understand?
internal/interfaces/svm.go
Outdated
Aggregates []map[string]string `mapstructure:"aggregates"` | ||
Name string `mapstructure:"name,omitempty"` | ||
SnapshotPolicy SnapshotPolicy `mapstructure:"snapshot_policy,omitempty"` | ||
Storage Storage `mapstructure:"storage"` |
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 it's optional, it should be set omitempty.
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.
OK, I did mark the optional storage
and (nested) limit
params as 'omitempty'. However, there's some code in place to delete empty params from the request body, which I've adapted to... don't think 'omitempty' will make any difference.
if setAggrEmpty {
delete(body, "aggregates")
}
if setCommentEmpty {
delete(body, "comment")
}
if setStorageLimitEmpty {
// delete storage.limit from request body, so that ONTAP uses default value
if v, ok := body["storage"].(map[string]interface{}); ok {
delete(v, "limit")
}
}
Signed-off-by: Achim Christ <achim.christ@sva.de>
Thanks @carchi8py and @chuyich for your feedback! I've added the I've also marked the optional params as 'omitempty', and did verify that acceptance tests (still) pass. Thanks much! |
Signed-off-by: Achim Christ <achim.christ@sva.de>
ceeb032
to
98e9570
Compare
Adds ability to configure
storage_limit
parameter of SVM.Closes #302.
Acceptance tests pass:
$ TF_ACC=1 go test ./internal/provider/svm/svm_resource_test.go -v === RUN TestAccSvmResource --- PASS: TestAccSvmResource (33.36s) PASS ok command-line-arguments 33.367s
Example Terraform Configuration: