Terraform retrieve list value using count

  Kiến thức lập trình

I am trying to retrieve the list values using count

variable vmi {
  type = list(string)
  default =[]
}

vmi = ["abc", "cde", "def"]

resource vpshere_virtual_machine vm {
  count = var.server_num
  vmi = var.vmi[count.index]
}

But it is printing abc every time. Can someone point me the mistake that I am making

LEAVE A COMMENT