-
Notifications
You must be signed in to change notification settings - Fork 11
feat: add VDB group update and tag management with acceptance tests #126
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
base: develop
Are you sure you want to change the base?
feat: add VDB group update and tag management with acceptance tests #126
Conversation
Linking the Issue #102 |
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.
Added review comments on some of my concerns.
Thanks
@@ -35,18 +35,38 @@ func resourceVdbGroup() *schema.Resource { | |||
Type: schema.TypeString, | |||
}, | |||
}, | |||
"tags": { | |||
Type: schema.TypeList, | |||
Optional: true, |
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 will need computed:true here, as without that, it will detect UIPs in case of auto-tagging.
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.
Done
updateVdbGroupReq.SetVdbIds(toStringArray(d.Get("vdb_ids"))) | ||
} | ||
|
||
_, httpRes, err := client.VDBGroupsAPI.UpdateVdbGroupById(ctx, vdbGroupId).UpdateVDBGroupParameters(updateVdbGroupReq).Execute() |
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 would be better to add the polling logic here. The api call looks like async process, so completion of this update api call doesn't guarantee a working vdb_group. So it would be better if we could poll till we have a status equivalent RUNNING.
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.
Done
} | ||
} | ||
|
||
if d.HasChange("tags") { |
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 update logic looks too complex and I am not sure if we really want a lookup logic around. As of now there are no tag update api. we explicitly need to delete the old one and create a new one.
The logic here ultimately does the same api call and there are no data retrieval involved, i dont see lookup being advantageous. Rather we can simply remove the old tags and create the new ones if there are changes.
I may be overlooking something so would really want other's opinions on 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.
Since tags are used for managing access, there could be potential race conditions when tags that should not be deleted get deleted as part of the update if we take the approach of deleting and recreating all tags?
internal/provider/utility.go
Outdated
@@ -212,14 +212,14 @@ func flattenDSourceHooks(hooks []dctapi.Hook, oldList []dctapi.SourceOperation) | |||
|
|||
func flattenTags(tags []dctapi.Tag) []interface{} { | |||
if tags != nil { | |||
returnedTags := make([]interface{}, len(tags)) | |||
result := make([]interface{}, len(tags)) |
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 this is just refactoring with no functional usage.
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
Also updating the PR and redirecting the incoming change sets to develop. |
b1acca3
to
afd41c2
Compare
Add VDB Group Update and Tag Management with Acceptance Tests
Overview
This PR introduces enhancements to the VDB group resource, focusing on two key areas:
1. VDB Group Updates
2. Tag Management
Testing
Note: All changes were generated by claude3.7