hashicorp / terraform-provider-vsphere

Terraform Provider for VMware vSphere
https://registry.terraform.io/providers/hashicorp/vsphere/
Mozilla Public License 2.0
611 stars 450 forks source link

Creating Resource Pool in Cluster with Scaleable Shares enabled causes error #1763

Open jacksonwg opened 1 year ago

jacksonwg commented 1 year ago

Community Guidelines

Terraform

1.3.1

Terraform Provider

2.2.

VMware vSphere

7.0.3

Description

Attempting to create a new child resource pool of an existing pool fails when the cluster is configured with scalable shares

Affected Resources or Data Sources

resource/vsphere_resource_pool

Terraform Configuration

terraform {
  required_providers {
    vsphere = {
      source = "hashicorp/vsphere"
      version = "2.2.0"
    }
  }
}

provider "vsphere" {
  allow_unverified_ssl = true
}

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

data "vsphere_resource_pool" "parent" {
  name = "Departments"
  datacenter_id = data.vsphere_datacenter.datacenter.id
}

resource "vsphere_resource_pool" "child" {
  name = "Child"
  parent_resource_pool_id = data.vsphere_resource_pool.parent.id
}

Debug Output

https://gist.github.com/jacksonwg/4303057a118f4852c4dc3e89acdca2f1

Panic Output

No response

Expected Behavior

Resource pool is created without error.

Actual Behavior

Looks like the vSphere API isn't allowing a value for the scalable shares attribute on the pool because it is set at the cluster level. The provider defaults to disabled but manually setting scaleCpuAndMemoryShares is also rejected.

Error from vCenter web console events is A specified parameter was not correct: ResourceConfigSpec Setting scaleDescendantsShares on the resource pool is not allowed because the descendants of resource pool 'Resources' are already scalable.

Steps to Reproduce

terraform apply --auto-approve with the above configuration after ensuring the names for the datacenter and parent resource pool objects match.

Environment Details

No response

Screenshots

No response

References

https://github.com/hashicorp/terraform-provider-vsphere/issues/1622

github-actions[bot] commented 1 year ago

Hello, jacksonwg! πŸ–

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.

tenthirtyam commented 1 year ago

@jacksonwg - can you test using the example as seen in the originating pull request?

https://github.com/hashicorp/terraform-provider-vsphere/pull/1634#issue-1177421836

jacksonwg commented 1 year ago

I tried with both examples.

The first, where the cluster is created with DRS and scalable shares, fails with an identical error to my example above when trying to create resource.vsphere_resource_pool.this

The second runs successfully.

But if I modify the second and add a third generation resource pool, setting the second generation as its parent then it fails with the same error. Modified second example here: https://gist.github.com/jacksonwg/f71535f61299b6587bb358bacc9e31b6

tenthirtyam commented 1 year ago

Thanks for confirming, @jacksonwg.

I'll take action to address this item, but unlikely for v2.3.0 given my current and planned availability.

If you'd like to research and submit a pull request for the fix, please review the contributing guidelines and I'll bee happy to review.

Ryan

coffmant commented 4 months ago

Any update on this one? Ran into it again today