canonical / terraform-provider-maas

Terraform MAAS provider
Mozilla Public License 2.0
60 stars 43 forks source link

add data source maas_vm_host so it can be provided dynamically to maas_vm_host_machine resource "vm_host" #122

Open noama-nv opened 9 months ago

noama-nv commented 9 months ago

add data source maas_vm_host so it can be provided dynamically to maas_vm_host_machine resource

https://registry.terraform.io/providers/maas/maas/latest/docs/resources/vm_host_machine

we would like to check if there are available kvm and spawn VMs

data "maas_vm_host" "kvm_host" {
  name = "krembu-kvm-host"
}

resource "maas_vm_host_machine" "vm1" {
  vm_host = data.maas_vm_host.kvm_host.id
  cores   = 1
  memory  = 2048
}
skatsaounis commented 9 months ago

Hi @krembu. Thank you for opening this issue. We will need a clarification on your feature request just to be sure.

Is it a datasource maas_vm_host that you need so as to make the following scenario work?

data "maas_vm_host" "kvm_host" {
  name = "krembu-kvm-host"
}

resource "maas_vm_host_machine" "vm1" {
  vm_host = data.maas_vm_host.kvm_host.id
  cores   = 1
  memory  = 2048
}

Otherwise, could you please explain more the part add data source maas_vm_host_machine so it can be provided dynamically to maas_vm_host_machine resource? I suspect that you have a typo but let's be sure.

noama-nv commented 9 months ago

@skatsaounis this is exactly what i wanted to say

seb54000 commented 4 months ago

Hi, I'm also very interested in this feature, do you know what is missing from the PR ?

I proposed a new PR as I'm not used to how update the existing one, sorry for that. All credits goes to @skatsaounis for this feature