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

feat: add virtual_machines list in d/datacenter #2276

Merged
merged 1 commit into from
Oct 16, 2024

Conversation

nikfot
Copy link
Contributor

@nikfot nikfot commented Oct 4, 2024

  • Add a list of virtual machine names under the specified datacenter

Description

There is a need to have a list of vm names in a datacenter. An example of it could be a number used as suffx for new vms, that depends on the names of the existing. In the GUI there is a tab with VMs in the datacenter view. So in the datasource datacenter a new attribute is added with virtual_machines.

Acceptance tests

  • Have you added an acceptance test for the functionality being added?
  • Have you run the acceptance tests on this branch?

Output from acceptance testing:

$ make testacc TESTARGS="-run=TestAccDataSourceVSphereDatacenter_getVirtualMachines"                                                                                  
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test $(go list ./... |grep -v 'vendor') -v -run=TestAccDataSourceVSphereDatacenter_getVirtualMachines -timeout 360m
?   	github.com/hashicorp/terraform-provider-vsphere	[no test files]
?   	github.com/hashicorp/terraform-provider-vsphere/vsphere/internal/administrationroles	[no test files]
?   	github.com/hashicorp/terraform-provider-vsphere/vsphere/internal/helper/clustercomputeresource	[no test files]
?   	github.com/hashicorp/terraform-provider-vsphere/vsphere/internal/helper/computeresource	[no test files]
?   	github.com/hashicorp/terraform-provider-vsphere/vsphere/internal/helper/contentlibrary	[no test files]
?   	github.com/hashicorp/terraform-provider-vsphere/vsphere/internal/helper/customattribute	[no test files]
?   	github.com/hashicorp/terraform-provider-vsphere/vsphere/internal/helper/datacenter	[no test files]
?   	github.com/hashicorp/terraform-provider-vsphere/vsphere/internal/helper/datastore	[no test files]
?   	github.com/hashicorp/terraform-provider-vsphere/vsphere/internal/helper/dvportgroup	[no test files]
?   	github.com/hashicorp/terraform-provider-vsphere/vsphere/internal/helper/envbrowse	[no test files]
?   	github.com/hashicorp/terraform-provider-vsphere/vsphere/internal/helper/folder	[no test files]
?   	github.com/hashicorp/terraform-provider-vsphere/vsphere/internal/helper/guestoscustomizations	[no test files]
?   	github.com/hashicorp/terraform-provider-vsphere/vsphere/internal/helper/hostsystem	[no test files]
?   	github.com/hashicorp/terraform-provider-vsphere/vsphere/internal/helper/network	[no test files]
?   	github.com/hashicorp/terraform-provider-vsphere/vsphere/internal/helper/nsx	[no test files]
?   	github.com/hashicorp/terraform-provider-vsphere/vsphere/internal/helper/ovfdeploy	[no test files]
?   	github.com/hashicorp/terraform-provider-vsphere/vsphere/internal/helper/provider	[no test files]
?   	github.com/hashicorp/terraform-provider-vsphere/vsphere/internal/helper/resourcepool	[no test files]
?   	github.com/hashicorp/terraform-provider-vsphere/vsphere/internal/helper/spbm	[no test files]
?   	github.com/hashicorp/terraform-provider-vsphere/vsphere/internal/helper/storagepod	[no test files]
?   	github.com/hashicorp/terraform-provider-vsphere/vsphere/internal/helper/structure	[no test files]
?   	github.com/hashicorp/terraform-provider-vsphere/vsphere/internal/helper/testhelper	[no test files]
?   	github.com/hashicorp/terraform-provider-vsphere/vsphere/internal/helper/utils	[no test files]
?   	github.com/hashicorp/terraform-provider-vsphere/vsphere/internal/helper/vappcontainer	[no test files]
?   	github.com/hashicorp/terraform-provider-vsphere/vsphere/internal/helper/virtualmachine	[no test files]
?   	github.com/hashicorp/terraform-provider-vsphere/vsphere/internal/helper/vsanclient	[no test files]
?   	github.com/hashicorp/terraform-provider-vsphere/vsphere/internal/helper/vsansystem	[no test files]
?   	github.com/hashicorp/terraform-provider-vsphere/vsphere/internal/vmworkflow	[no test files]
=== RUN   TestAccDataSourceVSphereDatacenter_getVirtualMachines
2024-10-04T14:36:32.579+0300 [WARN]  sdk.helper_schema: Previously configured provider being re-configured. This can cause issues in concurrent testing if the configurations are not equal.: tf_rpc=Configure tf_req_id=c88486fc-2d4e-724b-cc2d-8c8599420a85 tf_provider_addr=registry.terraform.io/hashicorp/vsphere
2024-10-04T14:36:33.443+0300 [WARN]  sdk.helper_schema: Previously configured provider being re-configured. This can cause issues in concurrent testing if the configurations are not equal.: tf_rpc=Configure tf_req_id=0d8fa8b5-a68e-74d7-8bd3-f773bfc910dc tf_provider_addr=registry.terraform.io/hashicorp/vsphere
2024-10-04T14:36:34.327+0300 [WARN]  sdk.helper_schema: Previously configured provider being re-configured. This can cause issues in concurrent testing if the configurations are not equal.: tf_req_id=ce3a82ae-25bc-1ac4-4b00-acf6000674e2 tf_provider_addr=registry.terraform.io/hashicorp/vsphere tf_rpc=Configure
2024-10-04T14:36:35.156+0300 [WARN]  sdk.helper_schema: Previously configured provider being re-configured. This can cause issues in concurrent testing if the configurations are not equal.: tf_req_id=590ff106-4155-b520-0bf9-7dfbb7c9a95d tf_provider_addr=registry.terraform.io/hashicorp/vsphere tf_rpc=Configure
2024-10-04T14:36:36.042+0300 [WARN]  sdk.helper_schema: Previously configured provider being re-configured. This can cause issues in concurrent testing if the configurations are not equal.: tf_rpc=Configure tf_provider_addr=registry.terraform.io/hashicorp/vsphere tf_req_id=38610c63-6e73-1e4b-9a78-47270a914953
--- PASS: TestAccDataSourceVSphereDatacenter_getVirtualMachines (34.97s)
PASS
ok  	github.com/hashicorp/terraform-provider-vsphere/vsphere	34.993s
testing: warning: no tests to run
PASS
ok  	github.com/hashicorp/terraform-provider-vsphere/vsphere/internal/helper/viapi	(cached) [no tests to run]
testing: warning: no tests to run
PASS
ok  	github.com/hashicorp/terraform-provider-vsphere/vsphere/internal/helper/virtualdisk	(cached) [no tests to run]
testing: warning: no tests to run
PASS
ok  	github.com/hashicorp/terraform-provider-vsphere/vsphere/internal/virtualdevice	(cached) [no tests to run]


...

Release Note

Release note for CHANGELOG:

- data/vsphere_datacenter: Fetch the list of virtual machine names for the specified datacenter.

References

@nikfot nikfot requested a review from a team as a code owner October 4, 2024 11:39
@github-actions github-actions bot added documentation Type: Documentation provider Type: Provider needs-review Status: Pull Request Needs Review labels Oct 4, 2024
@tenthirtyam tenthirtyam added this to the v2.10.0 milestone Oct 8, 2024
@tenthirtyam tenthirtyam changed the title feat: add virtual_machines list in d/datacenter feat: add virtual_machines list in d/datacenter Oct 8, 2024
Copy link
Collaborator

@tenthirtyam tenthirtyam left a comment

Choose a reason for hiding this comment

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

A couple minor comments provided.

Also, please open an enhancement issue and attach the issue to this pull request using the Closes #xxxx syntax in the Reference.

* Add a list of virtual machine names under the specified
datacenter

Signed-off-by: nikfot <[email protected]>
@nikfot
Copy link
Contributor Author

nikfot commented Oct 11, 2024

Closes: #2283

Copy link
Collaborator

@tenthirtyam tenthirtyam left a comment

Choose a reason for hiding this comment

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

LGTM! 🎉

@tenthirtyam tenthirtyam removed the needs-review Status: Pull Request Needs Review label Oct 11, 2024
@tenthirtyam tenthirtyam merged commit 39a21a8 into hashicorp:main Oct 16, 2024
6 checks passed
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 pull request 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 related to this change, 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
documentation Type: Documentation enhancement Type: Enhancement provider Type: Provider
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add virtual_machines list in d/datacenter
3 participants