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 to fetch datastores within a datastore cluster in d/datastore_stats #2159

Closed
4 tasks done
mrdevops100 opened this issue Mar 27, 2024 · 5 comments · Fixed by #2273
Closed
4 tasks done

Add support to fetch datastores within a datastore cluster in d/datastore_stats #2159

mrdevops100 opened this issue Mar 27, 2024 · 5 comments · Fixed by #2273
Labels
area/storage Area: Storage enhancement Type: Enhancement
Milestone

Comments

@mrdevops100
Copy link

mrdevops100 commented Mar 27, 2024

Community Guidelines

  • I have read and agree to the HashiCorp Community Guidelines .
  • Vote on this issue by adding a 👍 reaction to the original issue initial description to help the maintainers prioritize.
  • Do not leave "+1" or other comments that do not add relevant information or questions.
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment.

Terraform

v1.7.5

Terraform Provider

v2.7.0

VMware vSphere

v7.0

Description

When I use the "vsphere_datastore_stats" datasource it only fetches the top level datastores in a DC. It doesn't list the datastores under a datastore cluster.

Affected Resources or Data Sources

d/vsphere_datastore_stats

Terraform Configuration

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

data "vsphere_datastore_stats" "datastore_stats" {
  datacenter_id = data.vsphere_datacenter.datacenter.id
}

locals {
  free_space_values   = { for k, v in data.vsphere_datastore_stats.datastore_stats.free_space : k => tonumber(v) }
  filtered_values     = { for k, v in local.free_space_values : k => tonumber(v) if v != null }
  numeric_values      = [for v in values(local.filtered_values) : tonumber(v)]
  max_free_space      = max(local.numeric_values...)
  max_free_space_name = [for k, v in local.filtered_values : k if v == local.max_free_space][0]
}

output "max_free_space_name" {
  value = local.max_free_space_name
}

output "max_free_space" {
  value = local.max_free_space
}

Debug Output

Not available

Panic Output

Not available

Expected Behavior

Show all the datastores including the ones under datastore cluster

Actual Behavior

Datasource only fetches the top level datastores in a DC

Steps to Reproduce

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

data "vsphere_datastore_stats" "datastore_stats" {
  datacenter_id = data.vsphere_datacenter.datacenter.id
}

locals {
  free_space_values   = { for k, v in data.vsphere_datastore_stats.datastore_stats.free_space : k => tonumber(v) }
  filtered_values     = { for k, v in local.free_space_values : k => tonumber(v) if v != null }
  numeric_values      = [for v in values(local.filtered_values) : tonumber(v)]
  max_free_space      = max(local.numeric_values...)
  max_free_space_name = [for k, v in local.filtered_values : k if v == local.max_free_space][0]
}

output "max_free_space_name" {
  value = local.max_free_space_name
}

output "max_free_space" {
  value = local.max_free_space
}

Environment Details

No response

Screenshots

n/a

References

n/a

@mrdevops100 mrdevops100 added bug Type: Bug needs-triage Status: Issue Needs Triage labels Mar 27, 2024
Copy link

Hello, mrdevops100! 🖐

Thank you for submitting an issue for this provider. The issue will now enter into the issue lifecycle.

If you want to contribute to this project, please review the contributing guidelines and information on submitting pull requests.

@mrdevops100 mrdevops100 changed the title vsphere_datastore_stats does not consider the datastore under datastore cluster vsphere_datastore_stats does not fetch the datastores under a datastore cluster Mar 27, 2024
@tenthirtyam tenthirtyam removed the needs-triage Status: Issue Needs Triage label Mar 27, 2024
@tenthirtyam tenthirtyam added this to the Backlog milestone Mar 27, 2024
@tenthirtyam tenthirtyam added the area/storage Area: Storage label Jun 12, 2024
@tenthirtyam
Copy link
Collaborator

Hi @nikfot 👋 - would you like to pick this item up to enhance your addition in #1896?

Ryan Johnson
Distinguished Engineer, VMware by Broadcom

@tenthirtyam tenthirtyam changed the title vsphere_datastore_stats does not fetch the datastores under a datastore cluster d/datastore_stats does not fetch the datastores within a datastore cluster Jun 12, 2024
@tenthirtyam tenthirtyam changed the title d/datastore_stats does not fetch the datastores within a datastore cluster Add support to fetch datastores within a datastore cluster in d/datastore_stats Jun 12, 2024
@tenthirtyam tenthirtyam added enhancement Type: Enhancement and removed bug Type: Bug labels Jun 12, 2024
@nikfot
Copy link
Contributor

nikfot commented Jun 29, 2024

Hello @tenthirtyam ! I'm glad you notified me on that! sure! I will fix this.

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
area/storage Area: Storage enhancement Type: Enhancement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants