Skip to content
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

Add support for a vsphere_distributed_port_group data source #1410

Closed
pezhore opened this issue May 17, 2021 · 8 comments · Fixed by #2281
Closed

Add support for a vsphere_distributed_port_group data source #1410

pezhore opened this issue May 17, 2021 · 8 comments · Fixed by #2281
Assignees
Labels
acknowledged Status: Issue or Pull Request Acknowledged enhancement Type: Enhancement new-data-source Feature: New Data Source
Milestone

Comments

@pezhore
Copy link

pezhore commented May 17, 2021

Description

Although we have a resource for creating/manipulating a new distributed port group, there is no data source for retrieving a current distributed port group. This is challenging when attempting to use other resources (e.g. vsphere_entity_permissions) - requiring the end user to find the mo-ref/entity id manually.

The data resource would require a parent distributed virtual switch id and a port group name (used for searching/filtering distributed port groups). For brevity, I chose dvs_id but that could easily be virtualswitch_id or something else that's more robust.

Potential Terraform Configuration

data "vsphere_datacenter" "datacenter" {
  name = "dc1"
}

data "vsphere_distributed_virtual_switch" "dvs" {
  name          = "terraform-test-dvs"
  datacenter_id = data.vsphere_datacenter.datacenter.id
}

data "vsphere_distributed_port_group" "my-dvpg" {
 name   = "terraform-test-dvpg"
 dvs_id = data.vspherer_distributed_virtual_switch.dvs.id
}

References

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
@pezhore pezhore added the enhancement Type: Enhancement label May 17, 2021
@cerrakoth
Copy link

To add colour to why this would be useful - We would like to start deploying VMs via Terraform in an environment which already contains distributed port groups. We currently would need to create a new dpg managed by Terraform or import the existing dpg to the state which is not an optimal way of doing this.

@tenthirtyam tenthirtyam changed the title Data Source for Distributed Port Group missing Add support for a vsphere_distributed_virtual_switch data source Feb 4, 2022
@tenthirtyam tenthirtyam added acknowledged Status: Issue or Pull Request Acknowledged new-data-source Feature: New Data Source labels Feb 4, 2022
@tenthirtyam tenthirtyam self-assigned this Feb 10, 2022
@tenthirtyam tenthirtyam changed the title Add support for a vsphere_distributed_virtual_switch data source Add support for a vsphere_distributed_port_group data source Feb 13, 2022
@tenthirtyam tenthirtyam added this to the Research milestone Feb 14, 2022
@tenthirtyam tenthirtyam modified the milestones: Research, v2.2.0 Feb 24, 2022
@tenthirtyam tenthirtyam modified the milestones: v2.2.0, v2.3.0 Apr 7, 2022
@tenthirtyam tenthirtyam modified the milestones: v2.3.0, v2.4.0 Sep 9, 2022
@tenthirtyam tenthirtyam removed their assignment Feb 3, 2023
@tenthirtyam tenthirtyam modified the milestones: v2.4.0, v2.5.0 May 4, 2023
@tenthirtyam tenthirtyam modified the milestones: v2.5.0, Backlog Jul 25, 2023
@burnsjared0415 burnsjared0415 self-assigned this Oct 10, 2024
@burnsjared0415
Copy link
Collaborator

burnsjared0415 commented Oct 10, 2024

so this was just write for vsphere_network to pull back the distribution or standard switch portgroup by network_type and name would it work for this problem?
#2281

@pezhore
Copy link
Author

pezhore commented Oct 10, 2024

That might work? From my read of the Changelog on that PR, it would seem to cover my use case.

@burnsjared0415
Copy link
Collaborator

burnsjared0415 commented Oct 10, 2024

i updated it so it would look like this

data "vsphere_datacenter" "datacenter" {
  name = "dc-01"
}

data "vsphere_network" "my_port_group" {
  datacenter_id = data.vsphere_datacenter.datacenter.id
  name          = "VM Network"
  network_type = "Network"
  }

give it a run through, we can create a new data source with the same type code but did not know if this would work

@tenthirtyam tenthirtyam modified the milestones: Backlog, On Deck Oct 10, 2024
@pezhore
Copy link
Author

pezhore commented Oct 10, 2024

yeah that should work for me.!

@burnsjared0415 burnsjared0415 modified the milestones: On Deck, v2.10.0 Oct 10, 2024
@burnsjared0415
Copy link
Collaborator

I had to make a couple changes to the code, once it is release it, i will close out this issue

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
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
acknowledged Status: Issue or Pull Request Acknowledged enhancement Type: Enhancement new-data-source Feature: New Data Source
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants