Skip to content

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

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

sumedhbala-delphix
Copy link

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

  • Added support for updating a VDB group's name and VDB IDs.
  • Implemented acceptance tests to verify that a VDB group's name can be changed and that the group can be updated to reference different VDBs.

2. Tag Management

  • Improved the tag update logic to handle adding, updating, and removing tags efficiently.
  • Added acceptance tests to ensure that tags are correctly applied, updated, and removed from VDB groups.

Testing

  • All acceptance tests for VDB group updates and tag management have been added and verified to pass.
  • The tests cover scenarios such as changing the group name, updating VDB IDs, and managing tags.

Note: All changes were generated by claude3.7

@nick-mathison
Copy link
Contributor

Linking the Issue #102

Copy link
Contributor

@Uddipaan-Hazarika Uddipaan-Hazarika left a 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,
Copy link
Contributor

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.

Copy link
Author

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()
Copy link
Contributor

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.

Copy link
Author

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") {
Copy link
Contributor

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.

Copy link
Author

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?

@@ -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))
Copy link
Contributor

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.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

@Uddipaan-Hazarika
Copy link
Contributor

Also updating the PR and redirecting the incoming change sets to develop.

@Uddipaan-Hazarika Uddipaan-Hazarika changed the base branch from main to develop May 15, 2025 14:32
@sumedhbala-delphix sumedhbala-delphix force-pushed the feature/vdb-group-tag-enhancements-new branch from b1acca3 to afd41c2 Compare May 17, 2025 16:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants