Properly adding cpu/memory_hot_add_enabled to vsphere provider

hi guys,

noob trying to make terraform work by looking at other peoples’ examples/configs. I have been able to get the codes to work: main.tf, variabables.tf and terraform.tfvars to create vms in vsphere.

Now, i would like to add what the title says which is to add cpu_hot_add/memory_hot_add and cdrom. I haven’t looked the cdrom thing yet but added

cpu_hot_add_enabled = "true"

memory_hot_add_enabled = "true"

when I ran terraform plan, it says the following warnings for cpu/memory

│ Warning: Value for undeclared variable

│ The root module does not declare a variable named “cpu_hot_add_eanbled” but a value was found in file “terraform.tfvars”. If you meant to use this value,

│ add a “variable” block to the configuration.

so, does this mean that I need to add some variable in my variable.tf?

update: so I made some changes.

  1. in the terraform.tfvars file, I have the two lines below:vm_cpu_hot_add_enabled = “true” vm_memory_hot_add_enabled = “true”
  2. in the variables.tf files, added two lines below:variable “vm_cpu_hot_add_enabled” { description = “hot add cpu” } variable “vm_memory_hot_add_enabled” { description = “hot add memory” }
  3. in main.tf, added two lines below:cpu_hot_add_enabled = var.vm_cpu_hot_add_enabled memory_hot_add_enabled = var.vm_memory_hot_add_enabled

when I run terraform plan, it’s asking me to enter a value for both cpu/memory then errors out as before.

Thank you in advanced.