Skip to content

Instantly share code, notes, and snippets.

@AtaxyaNetwork
Created July 30, 2026 09:52
Show Gist options
  • Select an option

  • Save AtaxyaNetwork/063821310b542faba3198b7d16ebc094 to your computer and use it in GitHub Desktop.

Select an option

Save AtaxyaNetwork/063821310b542faba3198b7d16ebc094 to your computer and use it in GitHub Desktop.
Bulk create VLAN on Xen Orchestra with terraform
terraform {
required_providers {
xenorchestra = {
source = "vatesfr/xenorchestra"
version = ">= 0.35.0, < 1.0.0"
}
}
}
provider "xenorchestra" {
url = "ws://<IP>"
username = "<username>"
password = "<password>"
insecure = true
}
data "xenorchestra_pool" "pool" {
name_label = "my-pool"
}
resource "xenorchestra_network" "vlan_network" {
for_each = { for i in range(100, 130) : i => "VLAN${i}" }
name_label = each.value
pool_id = data.xenorchestra_pool.pool.id
source_pif_device = "bond0"
vlan = each.key
}
Result:
# xenorchestra_network.vlan_network["129"] will be created
+ resource "xenorchestra_network" "vlan_network" {
+ automatic = false
+ default_is_locked = false
+ id = (known after apply)
+ mtu = 1500
+ name_description = "Created with Xen Orchestra"
+ name_label = "VLAN129"
+ nbd = false
+ pool_id = "75469287-ec5e-8578-8c02-0865e343c751"
+ source_pif_device = "bond0"
+ vlan = 129
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment