diff --git a/deployment/check/common/data-model.nix b/deployment/check/common/data-model.nix index 08442b0a..e32e6083 100644 --- a/deployment/check/common/data-model.nix +++ b/deployment/check/common/data-model.nix @@ -28,6 +28,8 @@ let proxmox-user proxmox-password node-name + bridge + vlanId ; inherit (lib) mkOption types; eval = @@ -340,6 +342,8 @@ let proxmox-user proxmox-password node-name + bridge + vlanId ; root-path = pathToRoot; }; diff --git a/deployment/check/data-model-tf-proxmox/nixosTest.nix b/deployment/check/data-model-tf-proxmox/nixosTest.nix index 337efcd6..503e02f0 100644 --- a/deployment/check/data-model-tf-proxmox/nixosTest.nix +++ b/deployment/check/data-model-tf-proxmox/nixosTest.nix @@ -23,6 +23,8 @@ let proxmox-user = "root@pam"; proxmox-password = "mytestpw"; node-name = "pve"; + bridge = "br0"; + vlanId = 0; }; # FIXME generate the image `nixos-generate` was to make, but now do it for a desired `-c configuration.nix` rather than whatever generic thing now deployment = diff --git a/deployment/check/data-model-tf/options.nix b/deployment/check/data-model-tf/options.nix index 035cb047..8100c8c4 100644 --- a/deployment/check/data-model-tf/options.nix +++ b/deployment/check/data-model-tf/options.nix @@ -34,5 +34,15 @@ in description = "the name of the ProxmoX node to use."; type = types.str; }; + bridge = mkOption { + description = "The name of the network bridge (defaults to vmbr0)."; + type = types.str; + default = "vmbr0"; + }; + vlanId = mkOption { + description = "The VLAN identifier."; + type = types.int; + default = 0; + }; }; } diff --git a/deployment/data-model.nix b/deployment/data-model.nix index 745f3530..4a5369b7 100644 --- a/deployment/data-model.nix +++ b/deployment/data-model.nix @@ -354,6 +354,16 @@ let description = "environment variables to configure the TF HTTP back-end, see "; type = types.attrsOf (types.either types.str types.int); }; + bridge = mkOption { + description = "The name of the network bridge (defaults to vmbr0)."; + type = types.str; + default = "vmbr0"; + }; + vlanId = mkOption { + description = "The VLAN identifier."; + type = types.int; + default = 0; + }; run = mkOption { type = types.package; # error: The option `tf-deployment.tf-host.run' is read-only, but it's set multiple times. @@ -371,6 +381,8 @@ let proxmox-user proxmox-password node-name + bridge + vlanId ; inherit (ssh) host @@ -432,11 +444,13 @@ let inherit host nixos_conf + bridge ; + node_name = node-name; proxmox_user = proxmox-user; proxmox_password = proxmox-password; ssh_user = username; - node_name = node-name; + vlan_id = vlanId; }; tf-env = pkgs.callPackage ./run/tf-env.nix { inherit httpBackend; diff --git a/deployment/run/tf-proxmox/main.tf b/deployment/run/tf-proxmox/main.tf index 7bcca46b..e1e4ca4d 100644 --- a/deployment/run/tf-proxmox/main.tf +++ b/deployment/run/tf-proxmox/main.tf @@ -161,8 +161,8 @@ resource "proxmox_virtual_environment_vm" "nix_vm" { network_device { model = "virtio" - bridge = "ovsbr0" - vlan_id = 1305 + bridge = var.bridge + vlan_id = var.vlan_id } operating_system { diff --git a/deployment/run/tf-proxmox/variables.tf b/deployment/run/tf-proxmox/variables.tf index 0c940574..18beeab2 100644 --- a/deployment/run/tf-proxmox/variables.tf +++ b/deployment/run/tf-proxmox/variables.tf @@ -51,6 +51,18 @@ variable "image" { type = string } +variable "bridge" { + description = "The name of the network bridge (defaults to vmbr0)." + type = string + default = "vmbr0" +} + +variable "vlan_id" { + description = "The VLAN identifier." + type = number + default = 0 +} + ######################################### variable "category" {