Skip to content

Terraform search integration in ipam List resource #502

Open
AnilGadiyarHJ wants to merge 19 commits into
infobloxopen:mainfrom
AnilGadiyarHJ:ts_res
Open

Terraform search integration in ipam List resource #502
AnilGadiyarHJ wants to merge 19 commits into
infobloxopen:mainfrom
AnilGadiyarHJ:ts_res

Conversation

@AnilGadiyarHJ

Copy link
Copy Markdown
Collaborator

No description provided.

@AnilGadiyarHJ AnilGadiyarHJ requested a review from unasra May 20, 2026 05:36

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR adds Terraform list/query support for IPAM VLANs and aligns the existing VLAN resource with Terraform’s identity-based querying/import behavior.

Changes:

  • Added nios_ipam_vlan List Resource implementation with filter and extensible-attribute filter support, plus optional include_resource.
  • Added resource identity schema support to the existing nios_ipam_vlan resource and wired identity handling into CRUD + import.
  • Registered the new list resource in the provider and added acceptance tests + docs/examples.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
internal/service/ipam/vlan_resource.go Adds resource identity schema/behavior and sets identity during CRUD/import.
internal/service/ipam/vlan_list.go Implements the VLAN list/query resource with paging, filters, and optional full resource inclusion.
internal/service/ipam/vlan_list_test.go Adds acceptance tests for VLAN list resource basic and filtered queries.
internal/provider/provider.go Registers the new VLAN list resource with the provider.
examples/list-resources/nios_ipam_vlan/list-resource.tfquery.hcl Adds example queries for VLAN list usage (filters, EA filters, include_resource).
docs/list-resources/ipam_vlan.md Adds generated documentation for the VLAN list resource.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +96 to +100
// If total limit is set by user and is less than maxResultsPerPage, use it as maxResultsPerPage for API call to optimize the number of results.
// If limit > maxResultsPerPage, terraform automatically breaks connection to the provider after limit is reached.
if limit < maxResultsPerPage {
maxResultsPerPage = limit
}
Comment on lines +133 to +138
// If limit is reached , we do not need to continue to make API calls, we can return the results and empty nextPageID to stop pagination.
if len(res) >= int(limit) {
nextPageID = ""
tflog.Info(ctx, "Limit reached, stopped fetching more pages.")
return res, nextPageID, nil
}
Comment on lines +173 to +190
if req.IncludeResource {
var extAttrsAll types.Map
item.ExtAttrs, extAttrsAll, diags = RemoveInheritedExtAttrs(ctx, extAttrsAll, *item.ExtAttrs)
result.Diagnostics.Append(result.Resource.SetAttribute(ctx, path.Root("extattrs_all"), extAttrsAll)...)
if result.Diagnostics.HasError() {
if !push(result) {
return
}
continue
}
result1 := FlattenVlan(ctx, &item, &result.Diagnostics)
result.Diagnostics.Append(result.Resource.Set(ctx, &result1)...)
if result.Diagnostics.HasError() {
if !push(result) {
return
}
continue
}
Comment on lines 141 to 144
if diags.HasError() {
resp.Diagnostics.Append(diags...)
resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Error while create Vlan due inherited Extensible attributes, got error: %s", err))
return
Comment on lines 228 to 232
res.ExtAttrs, data.ExtAttrsAll, diags = RemoveInheritedExtAttrs(ctx, data.ExtAttrs, *res.ExtAttrs)
if diags.HasError() {
resp.Diagnostics.Append(diags...)
resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Error while reading Vlan due inherited Extensible attributes, got error: %s", diags))
return
Comment on lines +71 to +75
"extattrfilters": schema.MapAttribute{
MarkdownDescription: "External Attribute Filters are used to return a more specific list of results by filtering on external attributes. If you specify multiple filters, the results returned will have only resources that match all the specified filters.",
ElementType: types.StringType,
Optional: true,
},
Comment on lines +48 to +49
- `extattrfilters` (Map of String) External Attribute Filters are used to return a more specific list of results by filtering on external attributes. If you specify multiple filters, the results returned will have only resources that match all the specified filters.
- `filters` (Map of String) Filters are used to return a more specific list of results. Filters can be used to match resources by specific attributes, e.g. name. If you specify multiple filters, the results returned will have only resources that match all the specified filters.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants