dmacvicar / terraform-provider-libvirt

Terraform provider to provision infrastructure with Linux's KVM using libvirt
Apache License 2.0
1.58k stars 456 forks source link

feat: add data sources to extract node and device information #1042

Closed muresan closed 9 months ago

muresan commented 11 months ago

Hello,

this PR adds support for new data sources:

Apart from the changes to docs and provider.go to plugin in the documentation and the new resources, changes are in new files.

dmacvicar commented 1 week ago

Still puzzled how the test ever passed:

=== RUN   TestAccLibvirtNodeInfoDataSource
    data_source_libvirt_node_info_test.go:11: Step 1/2 error: Check failed: Check 1/1 error: data.libvirt_node_info.info: Attribute 'cpus' didn't match "^\\d+", got ""
-```
d.Set("cpu_model", int8ToString(model))
d.Set("cpu_cores_total", cpus)
d.Set("cpu_cores_per_socket", cores)
d.Set("numa_nodes", nodes)
d.Set("cpu_sockets", sockets)
d.Set("cpu_threads_per_core", threads)
d.Set("numa_nodes", nodes)
d.Set("memory_total_kb", memory)

Test tests for an attribute cpu, which has never been set. It is clear integration tests were not run, and shows the need to get them to run in CI with nested virtualization.