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

    Terraform

    Scheduled Pinned Locked Moved Xen Orchestra
    4 Posts 4 Posters 1.4k 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

            Hello! It looks like you're interested in this conversation, but you don't have an account yet.

            Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

            With your input, this post could be even better 💗

            Register Login
            • First post
              Last post