Skip to content

d/datastore_stats: fails when one of the datastores is inaccessible #2495

@pay64k

Description

@pay64k

Code of Conduct

  • I have read and agree to the Code of Conduct.
  • 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

1.11.4

Terraform Provider

2.13.0

VMware vSphere

8.0.3

Description

Hi, it seems that we have hit an edge scenario when trying to get vsphere_datastore_stats while one of the hosts are offline and so is the datastore associated with it.

Affected Resources or Data Sources

datasource/vsphere_datastore_stats

Terraform Configuration

terraform {
  required_providers {
    vsphere = {
      source = "vmware/vsphere"
      version = "~> 2.0"
    }
  }
}

variable "vmware_user" {}
variable "vmware_passw" {
  sensitive = true
}
variable "env_short" {}


provider "vsphere" {
  user                 = var.vmware_user
  password             = var.vmware_passw
  vsphere_server       = var.vsphere_server
  api_timeout          = 10
  allow_unverified_ssl = true
}

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

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

Debug Output

N/A

Panic Output

No response

Expected Behavior

List of datastores stats

Actual Behavior

Getting an error and it is not saying that the offline datastore is not found:

Image

Steps to Reproduce

Physically disconnect one of the hosts with a datastore without prior deleting it in vSphere so the datastore ends up in "inaccessible" state:

Image

Environment Details

No response

Screenshots

No response

References

No response

Metadata

Metadata

Assignees

Labels

Type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions