Skip to content

Terraform search [IPAM] - added implementation for bulkhostnametemplate & vlanview#492

Open
AnilGadiyarHJ wants to merge 20 commits into
infobloxopen:mainfrom
AnilGadiyarHJ:ts_bh_vlan
Open

Terraform search [IPAM] - added implementation for bulkhostnametemplate & vlanview#492
AnilGadiyarHJ wants to merge 20 commits into
infobloxopen:mainfrom
AnilGadiyarHJ:ts_bh_vlan

Conversation

@AnilGadiyarHJ

Copy link
Copy Markdown
Collaborator

No description provided.

@AnilGadiyarHJ AnilGadiyarHJ requested a review from unasra May 13, 2026 06:38

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/search) support for two IPAM object types—vlanview and bulk_hostname_template—by introducing new list resources and wiring up managed resources with identity schemas so query results can reference stable object identities (ref).

Changes:

  • Added list resources for nios_ipam_vlanview and nios_ipam_bulk_hostname_template with filtering support and pagination.
  • Added resource identity schema/behavior for VLAN View and Bulk Hostname Template managed resources (identity attribute ref) and persisted identity during CRUD.
  • Added acceptance tests plus example/query files and generated documentation for the new list resources.

Reviewed changes

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

Show a summary per file
File Description
internal/service/ipam/vlanview_resource.go Adds identity schema/behavior and sets identity during CRUD/import for VLAN Views.
internal/service/ipam/vlanview_list.go New list resource implementation for VLAN Views (filters, extattrfilters, include_resource).
internal/service/ipam/vlanview_list_test.go Acceptance tests for VLAN View list queries (basic, filters, extattrfilters).
internal/service/ipam/bulkhostnametemplate_resource.go Adds identity schema/behavior and sets identity during CRUD/import for Bulk Hostname Templates.
internal/service/ipam/bulkhostnametemplate_list.go New list resource implementation for Bulk Hostname Templates (filters/extattrfilters, include_resource).
internal/service/ipam/bulkhostnametemplate_list_test.go Acceptance tests for Bulk Hostname Template list queries (basic, filters).
internal/provider/provider.go Registers the new list resources with the provider.
examples/list-resources/nios_ipam_vlanview/list-resource.tfquery.hcl Example query configurations for VLAN View list resource.
examples/list-resources/nios_ipam_bulk_hostname_template/list-resource.tfquery.hcl Example query configurations for Bulk Hostname Template list resource.
docs/list-resources/ipam_vlanview.md Generated docs for VLAN View list resource.
docs/list-resources/ipam_bulk_hostname_template.md Generated docs for Bulk Hostname Template list resource.

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

Comment on lines 141 to 145
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 create Vlanview due inherited Extensible attributes, got error: %s", err))
return
Comment on lines 465 to +469
func (r *VlanviewResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) {
if req.Identity.Raw.IsKnown() {
diags := req.Identity.GetAttribute(ctx, path.Root("ref"), &req.ID)
if diags.HasError() {
resp.Diagnostics.Append(diags...)
Comment on lines 232 to 235
if diags.HasError() {
resp.Diagnostics.Append(diags...)
resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Error while reading Vlanview due inherited Extensible attributes, got error: %s", diags))
return
Comment on lines 386 to 390
res.ExtAttrs, data.ExtAttrsAll, diags = RemoveInheritedExtAttrs(ctx, planExtAttrs, *res.ExtAttrs)
if diags.HasError() {
resp.Diagnostics.Append(diags...)
resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Error while update Vlanview due inherited Extensible attributes, got error: %s", diags))
return
Comment on lines +173 to +191
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 := FlattenVlanview(ctx, &item, &result.Diagnostics)
result.Diagnostics.Append(result.Resource.Set(ctx, &result1)...)
if result.Diagnostics.HasError() {
if !push(result) {
return
}
continue
}

Comment on lines +105 to +112
request := l.client.IPAMAPI.
BulkhostnametemplateAPI.
List(ctx).
Filters(flex.ExpandFrameworkMapString(ctx, data.Filters, &diags)).
ReturnAsObject(1).
ReturnFieldsPlus(readableAttributesForBulkhostnametemplate).
Paging(paging).
MaxResults(maxResultsPerPage)
Comment on lines 291 to +295
func (r *BulkhostnametemplateResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) {
if req.Identity.Raw.IsKnown() {
diags := req.Identity.GetAttribute(ctx, path.Root("ref"), &req.ID)
if diags.HasError() {
resp.Diagnostics.Append(diags...)
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