vmware / terraform-provider-vcf

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

`r/vcf_edge_cluster` creation fails when `compute_cluster_id` is set #245

Open pradeep17j opened 4 days ago

pradeep17j commented 4 days ago

Code of Conduct

Terraform

1.7.2

Terraform Provider

0.11.0

VMware Cloud Foundation

5.2.1

Description

Edge Cluster creation fails with error

module.wld3_vcf_workload_domain.vcf_domain.workload_domain: Still creating... [1h21m42s elapsed]
module.wld3_vcf_workload_domain.vcf_domain.workload_domain: Creation complete after 1h21m46s [id=af99f426-36f5-4815-88bc-317d08536556]
╷
│ Error: you cannot set compute_cluster_id and compute_cluster_name at the same time
│
│   with module.vcf_edge_cluster.vcf_edge_cluster.cluster_1,
│   on ../../modules/vcf_edge_cluster/vcf_edge_cluster.tf line 18, in resource "vcf_edge_cluster" "cluster_1":
│   18: resource "vcf_edge_cluster" "cluster_1" {
│
╵

Affected Resources or Data Sources

resource\vcf_edge_cluster

Terraform Configuration

Snippet of HCL code is here. A link to internal repo will be provided through secure channels

module "wld4_vcf_workload_domain" {
  source = "../../modules/vcf_workload_domain"

  # --------------------------------------------------------------- #
  # Fourth JPMC WLD, share NSXT with WLD2
  # --------------------------------------------------------------- #

  domain_suffix        = "vrack.vsphere.local"
  workload_domain_name = "wld4"
  share_nsxt_with_workload_domain = "wld2"
  license_keys         = var.license_keys
  #
  #wld_passwords         = var.wld_passwords
  vcenter_configuration = var.wld4_vcenter_configuration
  nsx_settings          = var.wld2_nsx_settings
  #
  #wld_cluster_settings  = var.wld_cluster_settings
  #network_pool_host_tep = var.network_pool_host_tep
  #wld_hosts             = var.wld_hosts
  wld_hosts = tomap(module.wld4_host_comm.host_id)

  depends_on = [ module.wld2_vcf_workload_domain ]
}

module "clus02_host_comm" {
  source = "../../modules/vcf_host_commission"

  net_pool_id = var.net_pool_id
  comm_hosts = var.clus02_comm_hosts

}

module "wld1_cluster02" {
    source = "../../modules/vcf_cluster_add"

    domain_id = module.wld4_vcf_workload_domain.domain_id
    wld_hosts = tomap(module.clus02_host_comm.host_id)

}

module "vcf_edge_cluster" {
  source = "../../modules/vcf_edge_cluster"

  compute_cluster_id = module.wld1_cluster02.clus_id
  edge_cluster_name = var.edge_cluster_name
  edge_node_fqdn_ip = var.edge_node_fqdn_ip

  #sddc_manager_host = var.sddc_manager_host
  #sddc_manager_username = var.sddc_manager_username
  #sddc_manager_password  = var.sddc_manager_password

  edge_uplink_iface_ips = var.edge_uplink_iface_ips
  edge_tep_vlan = var.edge_tep_vlan
  edge_uplink_vlans = var.edge_uplink_vlans
  edge_bgp_peer_ips = var.edge_bgp_peer_ips

  edge_mgmt_gw = var.edge_mgmt_gw
  edge_tep_ips = var.edge_tep_ips

  edge_tep_gw = var.edge_tep_gw
}

Debug Output

module.wld3_vcf_workload_domain.vcf_domain.workload_domain: Still creating... [1h21m2s elapsed]
module.wld3_vcf_workload_domain.vcf_domain.workload_domain: Still creating... [1h21m12s elapsed]
module.wld3_vcf_workload_domain.vcf_domain.workload_domain: Still creating... [1h21m22s elapsed]
module.wld3_vcf_workload_domain.vcf_domain.workload_domain: Still creating... [1h21m32s elapsed]
module.wld3_vcf_workload_domain.vcf_domain.workload_domain: Still creating... [1h21m42s elapsed]
module.wld3_vcf_workload_domain.vcf_domain.workload_domain: Creation complete after 1h21m46s [id=af99f426-36f5-4815-88bc-317d08536556]
╷
│ Error: you cannot set compute_cluster_id and compute_cluster_name at the same time
│
│   with module.vcf_edge_cluster.vcf_edge_cluster.cluster_1,
│   on ../../modules/vcf_edge_cluster/vcf_edge_cluster.tf line 18, in resource "vcf_edge_cluster" "cluster_1":
│   18: resource "vcf_edge_cluster" "cluster_1" {
│

Panic Output

No response

Expected Behavior

Successful creation of edge cluster

Actual Behavior

Fails to create edge cluster.

In the HCL file only compute_cluster_id is provided. There is no compute_cluster_name provided.

Steps to Reproduce

terraform apply with full HCL file

Environment Details

No response

Screenshots

No response

References

No response

spacegospod commented 4 days ago

I came across this problem recently, it's due to this line and the fact that the cluster name defaults to an empty string. The condition that checks it should not treat an empty string as a valid value.

To unblock yourself @pradeep17j use a cluster name instead of an ID for now.

And even though this problem is not related to the version of VCF you're using, I want to use the opportunity to remind you that we only support VCF up to version 5.1. We are actively working on moving up to 5.2.X