vmware / terraform-provider-vcf

Terraform Provider for VMware Cloud Foundation
https://registry.terraform.io/providers/vmware/vcf/
Mozilla Public License 2.0
23 stars 10 forks source link

Error: REMOVE_HOST operation validation failed #201

Closed pradeep17j closed 2 months ago

pradeep17j commented 3 months ago

Code of Conduct

Terraform

1.9.2

Terraform Provider

0.9.1

VMware Cloud Foundation

5.2

Description

Remove host operation on a cluster fails with error message below.

Message: REMOVE_HOST operation validation failed due to: Cluster HA/DRS: Check if cluster has HA & DRS enabled

Remediation Message:

Reference Token: PJUHO6

Cause: 

This happens because the provider by default sets the high_availability_enabled": false, Below is the snippet of terraform.tfstate file which shows that high_availability_enabled=False.

The provider should set this to true.

{
  "version": 4,
  "terraform_version": "1.9.2",
  "serial": 20,
  "lineage": "1a400f44-29a9-8c66-e115-5f240a8fdca6",
  "outputs": {},
  "resources": [
    {
      "mode": "managed",
      "type": "vcf_domain",
      "name": "workload_domain1",
      "provider": "provider[\"registry.terraform.io/vmware/vcf\"]",
      "instances": [
        {
          "schema_version": 0,
          "attributes": {
            "cluster": [
              {
                "cluster_image_id": "",
                "evc_mode": "",
                "geneve_vlan_id": 200,
                "high_availability_enabled": false,
                "host": [
                  {

Affected Resources or Data Sources

r/workload_domain

Terraform Configuration

resource "vcf_domain" "workload_domain1" {
  name = "sfo-w01-vc01"

  #vCenter Settings
  vcenter_configuration {
    name            = var.wld1_vcenter_configuration["name"]
    fqdn            = var.wld1_vcenter_configuration["fqdn"]
    vm_size         = var.wld1_vcenter_configuration["vm_size"]
    storage_size    = var.wld1_vcenter_configuration["storage_size"]
    ip_address      = var.wld1_vcenter_configuration["ip"]
    subnet_mask     = var.wld1_vcenter_configuration["subnet_mask"]
    gateway         = var.wld1_vcenter_configuration["gateway"]
    datacenter_name = "${var.workload_domain1_name}-dc"
    root_password   = var.wld_passwords["vcenter"]
  }

Debug Output

vcf_domain.workload_domain1: Modifying... [id=7eaebd4a-d7da-4de0-81c5-2c53faedefb3]
vcf_domain.workload_domain1: Still modifying... [id=7eaebd4a-d7da-4de0-81c5-2c53faedefb3, 10s elapsed]
vcf_domain.workload_domain1: Still modifying... [id=7eaebd4a-d7da-4de0-81c5-2c53faedefb3, 20s elapsed]
vcf_domain.workload_domain1: Still modifying... [id=7eaebd4a-d7da-4de0-81c5-2c53faedefb3, 30s elapsed]
vcf_domain.workload_domain1: Still modifying... [id=7eaebd4a-d7da-4de0-81c5-2c53faedefb3, 40s elapsed]
vcf_domain.workload_domain1: Still modifying... [id=7eaebd4a-d7da-4de0-81c5-2c53faedefb3, 50s elapsed]
vcf_domain.workload_domain1: Still modifying... [id=7eaebd4a-d7da-4de0-81c5-2c53faedefb3, 1m0s elapsed]
ā•·
ā”‚ Error: Task with ID = e2ece250-7875-4cd8-a67d-7082faacafdc , Name: "Removing host(s) from cluster" Type: "CLUSTER_COMPACTION" is in state Failed
ā”‚
ā”‚   with vcf_domain.workload_domain1,
ā”‚   on wld1.tf line 134, in resource "vcf_domain" "workload_domain1":
ā”‚  134: resource "vcf_domain" "workload_domain1" {
ā”‚
ā•µ

Panic Output

No response

Expected Behavior

Remove host operation on a cluster should have succeeded.

Actual Behavior

Fails to remove because by default the vSphere HA is OFF.

Steps to Reproduce

Environment Details

No response

Screenshots

No response

References

No response

tenthirtyam commented 3 months ago

Please use the markdown editor to formal the hcl and console output for readability

Reference: https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/creating-and-highlighting-code-blocks

tenthirtyam commented 3 months ago

Proper formatting applied for maintainer readability and historical context.

spacegospod commented 3 months ago

high_availability_enabled is optional and simply setting it to true should work around the problem.

As for the default value - it should stay false. This is an optional property according to the documentation https://developer.broadcom.com/xapis/vmware-cloud-foundation-api/latest/data-structures/AdvancedOptions/ Furthermore enabling HA on a cluster should be a concious decision and should be specified explicitly by the user.

tenthirtyam commented 2 months ago

Closing per https://github.com/vmware/terraform-provider-vcf/issues/201#issuecomment-2259841530.

github-actions[bot] commented 1 month ago

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.