Terraform
-
Hi,
I am reading https://xen-orchestra.com/blog/virtops1-xen-orchestra-terraform-provider/ and https://registry.terraform.io/providers/terra-farm/xenorchestra/latest/docs, and I can't find information how to set the IP address of the machine in the terraform plan.
Is there a way to do it?
Thanks in advance.
-
Pinging @ddelnano about this
-
I didn't try the provider, but there is an option
cloud_network_config
, you should be able to pass network config as in Xen Orchestra UI using cloud-init. -
@ruskofd is right. You should be able to use the
cloud_network_config
attribute to achieve this.The following code is untested but should launch a vm with a static IP. Please see the xenorchestra_vm resource docs and the cloud-init networking v1 docs for more details.
resource "xenorchestra_vm" "static_ip_vm" { .... cloud_network_config = <<EOF network: version: 1 config: - type: physical name: eth0 subnets: - type: static address: STATIC_IP/24 gateway: GATEWAY_IP dns_nameservers: - 8.8.8.8 EOF }
Let me know if you have any questions or issues using
cloud_network_config
,As for the blog post, the VM would have been assigned an ip address via dhcp (assuming the guest OS had cloud-init installed which was true for the VM template in the blog post).