<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[XO and terraform]]></title><description><![CDATA[<p dir="auto">hi guys</p>
<p dir="auto">im rather new to XCP and Terraform.</p>
<p dir="auto">I am an adult student in system and network engineering (last year) and for my project i have chosen to deploy VMs with terraform. configuring with most likely ansible.</p>
<p dir="auto">So far i am able to deploy a VM however at first run of my ''playbook'' it creates the VM and no disk is being created. second run the disk is created and attached but in a diconnected state.</p>
<p dir="auto">then i need to shut down the VM in XO and run my terraform template once again, the VM is being powered on and the disk is connected.</p>
<p dir="auto">im not sure what causes this behaviour.</p>
<p dir="auto">here is my current template.</p>
<p dir="auto">here is my current template.</p>
<pre><code>terraform {
  required_providers {
    xenorchestra = {
      source  = "terra-farm/xenorchestra"
      version = "~&gt; 0.26.0"
    }
  }
}

provider "xenorchestra" {
  url      = "wss://"my_xo_ip"
  username = "myusername"
  password = "Mypassword"
  insecure = true
}

# Fetch the template
data "xenorchestra_template" "vm_template" {
  name_label = "Terraform_Template_Win_Core"
}

# Fetch the network
data "xenorchestra_network" "network" {
  name_label = "eth0"
}

# Fetch the storage repository
data "xenorchestra_sr" "sr" {
  name_label = "Local storage"
}

# Create the VM with explicit dependency on the storage repository
resource "xenorchestra_vm" "vm1" {
  name_label = "terraform_VM"
  template   = data.xenorchestra_template.vm_template.id
  cpus       = 2
  memory_max = 4294967296

  # Network configuration
  network {
    network_id = data.xenorchestra_network.network.id
  }

  # Disk configuration with explicit dependency on storage repository
  disk {
    sr_id      = data.xenorchestra_sr.sr.id
    size       = 10737418240
    name_label = "VM root volume"
  }

  # CD-ROM configuration
  cdrom {
    id = "09ab237e-9a35-4d88-b787-24c1b6fa7779"
  }

  # Automatically power on the VM
  power_state = "Running"

  # Ensure the VM depends on the successful creation of the storage repository
  depends_on = [data.xenorchestra_sr.sr]
}
</code></pre>
<p dir="auto">its also suboptimal as i then would need to run the windows ISO from the XO console..</p>
<p dir="auto">any tips would be greatly appreciated.</p>
]]></description><link>https://xcp-ng.org/forum/topic/10234/xo-and-terraform</link><generator>RSS for Node</generator><lastBuildDate>Mon, 07 Sep 2026 20:43:22 GMT</lastBuildDate><atom:link href="https://xcp-ng.org/forum/topic/10234.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 08 Jan 2025 18:37:45 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to XO and terraform on Mon, 27 Jan 2025 07:59:35 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/forum/user/wezke" aria-label="Profile: wezke">@<bdi>wezke</bdi></a> you are welcome. let us know if you find the explanation for the problem with the template <img src="https://xcp-ng.org/forum/assets/plugins/nodebb-plugin-emoji/emoji/android/1f642.png?v=2bdbead4301" class="not-responsive emoji emoji-android emoji--slightly_smiling_face" style="height:23px;width:auto;vertical-align:middle" title=":)" alt="🙂" /></p>
]]></description><link>https://xcp-ng.org/forum/post/88866</link><guid isPermaLink="true">https://xcp-ng.org/forum/post/88866</guid><dc:creator><![CDATA[Cyrille]]></dc:creator><pubDate>Mon, 27 Jan 2025 07:59:35 GMT</pubDate></item><item><title><![CDATA[Reply to XO and terraform on Sat, 25 Jan 2025 18:39:11 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/forum/user/cyrille" aria-label="Profile: Cyrille">@<bdi>Cyrille</bdi></a></p>
<p dir="auto">ive made the template from running an Windows 2022 from my iso storage untill initial process was installed, shutdown the vm and created a template.</p>
<p dir="auto">Edit:  you are correct, using a builtin template has no issue's.<br />
going to solve that problem first <img src="https://xcp-ng.org/forum/assets/plugins/nodebb-plugin-emoji/emoji/android/1f642.png?v=2bdbead4301" class="not-responsive emoji emoji-android emoji--slightly_smiling_face" style="height:23px;width:auto;vertical-align:middle" title=":)" alt="🙂" /></p>
<p dir="auto">thank you for the support</p>
]]></description><link>https://xcp-ng.org/forum/post/88839</link><guid isPermaLink="true">https://xcp-ng.org/forum/post/88839</guid><dc:creator><![CDATA[wezke]]></dc:creator><pubDate>Sat, 25 Jan 2025 18:39:11 GMT</pubDate></item><item><title><![CDATA[Reply to XO and terraform on Fri, 24 Jan 2025 09:02:51 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/forum/user/wezke" aria-label="Profile: wezke">@<bdi>wezke</bdi></a> Hi, I have no problem running your terraform plan, maybe there is a problem with the template you are using? How did you create it?</p>
<p dir="auto">There is no warning during the tf execution?</p>
]]></description><link>https://xcp-ng.org/forum/post/88756</link><guid isPermaLink="true">https://xcp-ng.org/forum/post/88756</guid><dc:creator><![CDATA[Cyrille]]></dc:creator><pubDate>Fri, 24 Jan 2025 09:02:51 GMT</pubDate></item><item><title><![CDATA[Reply to XO and terraform on Wed, 22 Jan 2025 10:25:04 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/forum/user/nathanael-h" aria-label="Profile: nathanael-h">@<bdi>nathanael-h</bdi></a></p>
<p dir="auto">changed block provider to the latest version</p>
<pre><code>terraform {
  required_providers {
    xenorchestra = {
      source  = "vatesfr/xenorchestra"
      version = "0.29.0"
    }
  }
}
</code></pre>
<p dir="auto">acts just the same way i must say.</p>
]]></description><link>https://xcp-ng.org/forum/post/88618</link><guid isPermaLink="true">https://xcp-ng.org/forum/post/88618</guid><dc:creator><![CDATA[wezke]]></dc:creator><pubDate>Wed, 22 Jan 2025 10:25:04 GMT</pubDate></item><item><title><![CDATA[Reply to XO and terraform on Tue, 14 Jan 2025 15:49:11 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/forum/user/wezke" aria-label="Profile: wezke">@<bdi>wezke</bdi></a> Hello, can you switch to this latest version of the provider, ensure that your configuration is still valid or fix what would be needed, and report how it behaves?</p>
<p dir="auto"><a href="https://registry.terraform.io/providers/vatesfr/xenorchestra/latest" target="_blank" rel="noopener noreferrer nofollow ugc">https://registry.terraform.io/providers/vatesfr/xenorchestra/latest</a></p>
]]></description><link>https://xcp-ng.org/forum/post/88110</link><guid isPermaLink="true">https://xcp-ng.org/forum/post/88110</guid><dc:creator><![CDATA[nathanael-h]]></dc:creator><pubDate>Tue, 14 Jan 2025 15:49:11 GMT</pubDate></item></channel></rss>