Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

d/vsphere_network errors if networks of different types use the same name #1143

Closed
skevir opened this issue Jul 24, 2020 · 7 comments · Fixed by #2281
Closed

d/vsphere_network errors if networks of different types use the same name #1143

skevir opened this issue Jul 24, 2020 · 7 comments · Fixed by #2281
Assignees
Labels
acknowledged Status: Issue or Pull Request Acknowledged area/networking Area: Networking community/contribution Community: Contribution Help Wanted enhancement Type: Enhancement
Milestone

Comments

@skevir
Copy link
Contributor

skevir commented Jul 24, 2020

Description

I am working with a vSphere set-up in which there is a standard (host-based) port group and a DVS port group that both have the same name. Thus trying to create a vsphere_network data object fails with the following error:

error fetching network: path 'myPortGroup' resolves to multiple networks, Please specify

Here's the vsphere_network data object from the Terraform file:

data "vsphere_network" "my_port_group" {
  datacenter_id = data.vsphere_datacenter.dc.id
  name          = "myPortGroup"
}

I'm trying to get the standard port group, so it would be really useful to be able to specify the type in the above to be able to indicate which type of network I am interested in.

This looks related to the change that was made by this pull request: #1001 - for differentiating between DVS port groups with the same name where a distributed_virtual_switch_uuid argument was added.

Does such a change sound sensible? Or am I missing something and there is already a way I could disambiguate the two port groups?

Potential Terraform Configuration

data "vsphere_network" "my_port_group" {
  datacenter_id = data.vsphere_datacenter.dc.id
  name          = "myPortGroup"
  type            = "<type of network>"
}

where type of network is one of "DistributedVirtualPortgroup", "Network" or "OpaqueNetwork".

References

#925

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment
@skevir skevir added the enhancement Type: Enhancement label Jul 24, 2020
@codeopen1
Copy link
Contributor

codeopen1 commented Jul 25, 2020

I think a better approach, in my opinion, would be to split out the vsphere_network data resource in to 3 separate ones:

  • vsphere_distributed_port_group
  • vsphere_host_port_group
  • vsphere_opaque_network

I'd also suggest adding a data resource for vsphere_host_port_group (there is already one for DVS).

That would bring the network data resources into line with the regular resource types + an extra one for opaque networks.
This would give more information to the user and greater flexibility.

Looking at the docs, Network is a managed object extended by DistributedVirtualPortgroup and OpaqueNetwork [1] and HostPortGroup is just a data object [2]. I think it makes sense to expose the most specific objects to the user instead of the higher-level ones.

Thoughts?

I'd be happy to take a look at this as part of #1145

Edit - It looks like the HostOpaqueNetworkInfo [3] might be a more complete model for an vsphere_opaque_network data resource.

[1] - https://vdc-download.vmware.com/vmwb-repository/dcr-public/b50dcbbf-051d-4204-a3e7-e1b618c1e384/538cf2ec-b34f-4bae-a332-3820ef9e7773/vim.Network.html
[2] - https://vdc-download.vmware.com/vmwb-repository/dcr-public/b50dcbbf-051d-4204-a3e7-e1b618c1e384/538cf2ec-b34f-4bae-a332-3820ef9e7773/vim.host.PortGroup.html
[3] - https://vdc-download.vmware.com/vmwb-repository/dcr-public/b50dcbbf-051d-4204-a3e7-e1b618c1e384/538cf2ec-b34f-4bae-a332-3820ef9e7773/vim.host.OpaqueNetworkInfo.html

@skevir
Copy link
Contributor Author

skevir commented Jul 27, 2020

Yes - agreed - that sounds like a sensible approach, although I'm very new to the provider so don't really have a feel for the best architectural way to address this. Others are probably in a better position to provide concrete input.

My first thought was thinking about backwards compatibility, but I believe you are suggesting leaving the current vsphere_network functionality as is, and simply ensuring there are more specific network data resources for each of the potential types, so no concerns there.

@bill-rich bill-rich added community/contribution Community: Contribution Help Wanted acknowledged Status: Issue or Pull Request Acknowledged labels Jul 28, 2020
@codeopen1
Copy link
Contributor

I don't really have an opinion on the backwards compatibility but I would hazard a guess that either the existing vsphere_network data resource would stay as an option or get deprecated. I think that's up to the core maintainers but I think the additional functionality and specificity suggested would still be useful.

@bill-rich
Copy link
Contributor

I can see the benefits to both approaches, but I think that it would be better to add the type field to the existing data source. It definitely makes sense looking at the Terraform side of things to make the data sources match the resources, but it does take us further from the workflow in the vSphere client. Let me know if you have further thoughts.

@tenthirtyam tenthirtyam added the area/networking Area: Networking label Feb 22, 2022
@tenthirtyam tenthirtyam self-assigned this Mar 10, 2022
@tenthirtyam tenthirtyam changed the title vsphere_network data object hits an error if networks of different types use the same name d/vsphere_network errors if networks of different types use the same name Mar 11, 2022
@tenthirtyam tenthirtyam added this to the Backlog milestone Mar 21, 2022
@tenthirtyam tenthirtyam removed their assignment Mar 21, 2022
@haydenseitz
Copy link

I am having the same issue, where I cannot specify a host-based port group with the same name as a VDS port group. It is possible to specify the distributed port group by using distributed_virtual_switch_uuid when querying for vsphere_network, but not the other way around.

Copy link

This functionality has been released in v2.10.0 of the Terraform Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you!

Copy link

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 16, 2024
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
acknowledged Status: Issue or Pull Request Acknowledged area/networking Area: Networking community/contribution Community: Contribution Help Wanted enhancement Type: Enhancement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants