Created
July 30, 2026 09:52
-
-
Save AtaxyaNetwork/063821310b542faba3198b7d16ebc094 to your computer and use it in GitHub Desktop.
Bulk create VLAN on Xen Orchestra with terraform
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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