-
Notifications
You must be signed in to change notification settings - Fork 8
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. |
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.
Hello @chuyich, thank you very much for reviewing this PR. I have updated the docs and added cluster version checks to Thanks much! |
19f6f0b
to
4880190
Compare
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?
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 may use
PlanModifiers: []planmodifier.Int64{
IntUseStateForUnknown(),
},
ref. https://github.com/NetApp/terraform-provider-netapp-ontap/blob/integration/main/internal/provider/storage/storage_aggregate_resource.go#L159 and see how to handle this parameter in creation/read/update. Since it's optional in the API call, the default value does not have to be set.
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")
}
}
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 @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! |
ceeb032
to
98e9570
Compare
0eaabad
to
ed4593e
Compare
@acch sorry for the late response, i was out last week with a small family emergency. We will need you to rebase all your pull requests. There was a security issue that required us to rewrite the git history that we made last week. Because of this any pull request or Fork that hasn't rebased is going to appear as all files have been modified. Can you please rebase your pull request. |
Signed-off-by: Achim Christ <[email protected]>
Signed-off-by: Achim Christ <[email protected]>
Signed-off-by: Achim Christ <[email protected]>
Signed-off-by: Achim Christ <[email protected]>
Signed-off-by: Achim Christ <[email protected]>
Signed-off-by: Achim Christ <[email protected]>
Signed-off-by: Achim Christ <[email protected]>
Signed-off-by: Achim Christ <[email protected]>
Signed-off-by: Achim Christ <[email protected]>
Signed-off-by: Achim Christ <[email protected]>
98e9570
to
b6b55ac
Compare
@carchi8py Sure, I just rebased all PR's. For our internal planning: how much more time do you think will be required to incorporate our changes into a release available from Terraform registry? Is there already a (rough) target for the 2.1 release? |
@acch we don't have a rough date for a release. Let me talk to the team. But we don't have any hard requirement for 2.1 so we should be able to make 2.1 just your 6 pull request once there merge in and anything move everything else to 2.2. |
@carchi8py Are we good to merge this PR? Please let me know what I need to do exactly to have the PRs added to the provider. My understanding is that I've addressed all requested changes... please let me know what's missing. Many thanks! |
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: