XCP-ng
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    Terraform

    Scheduled Pinned Locked Moved Xen Orchestra
    4 Posts 4 Posters 926 Views 2 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • T Offline
      TodorPetkov
      last edited by

      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.

      1 Reply Last reply Reply Quote 0
      • olivierlambertO Offline
        olivierlambert Vates 🪐 Co-Founder CEO
        last edited by

        Pinging @ddelnano about this 🙂

        1 Reply Last reply Reply Quote 0
        • ruskofdR Offline
          ruskofd
          last edited by

          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.

          1 Reply Last reply Reply Quote 1
          • D Offline
            ddelnano Terraform Team
            last edited by ddelnano

            @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).

            1 Reply Last reply Reply Quote 2
            • First post
              Last post