diff --git a/.github/workflows/vm-creation-terraform.yaml b/.github/workflows/vm-creation-terraform.yaml index 38ac31a..ca23f24 100644 --- a/.github/workflows/vm-creation-terraform.yaml +++ b/.github/workflows/vm-creation-terraform.yaml @@ -52,6 +52,9 @@ jobs: vm_count = random.choice(testVars['vm_count']), vm_num_cpus = random.choice(testVars['vm_num_cpus']), pve_datastore = random.choice(testVars['pve_datastore']), + pve_network = random.choice(testVars['pve_network']), + vm_disk_size = random.choice(testVars['vm_disk_size']), + vm_memory = random.choice(tastVars['vm_memory']), ) # Save template diff --git a/tests/templates/module.tpl b/tests/templates/module.tpl index 1ab1f17..aab4267 100644 --- a/tests/templates/module.tpl +++ b/tests/templates/module.tpl @@ -8,14 +8,14 @@ module "proxmox-vm" { pve_cluster_node = "sthings-pve1" pve_datastore = "{{ pve_datastore }}" pve_folder_path = "stuttgart-things" - pve_network = "vmbr103" + pve_network = "{{ pve_network }}" vm_count = {{ vm_count }} vm_name = "{{ name }}" vm_notes = "vm-info" vm_template = "ubuntu22" vm_num_cpus = "{{ vm_num_cpus }}" - vm_memory = "4096" - vm_disk_size = "32G" + vm_memory = {{ vm_memory }} + vm_disk_size = "{{ vm_disk_size }}" vm_ssh_user = var.vm_ssh_user vm_ssh_password = var.vm_ssh_password } diff --git a/tests/test_values.yaml b/tests/test_values.yaml index cd91ad5..8e3c2b2 100644 --- a/tests/test_values.yaml +++ b/tests/test_values.yaml @@ -8,7 +8,24 @@ vm_num_cpus: # should pick one of them randomly - 2 - 4 - 8 -#vm_name: #E.G. RANDOM NAME W/ LENGHT XY OR PREFIX MAYBE - UP TO YOU BUT THING OF CONSTRAINS LIKE LENGHT OR FORBIDDEN CHARS LIKE _ pve_datastore: # should pick one of them randomly - datastore - - v3700 \ No newline at end of file + - v3700 +pve_network: + - vmbr101 + - vmbr102 + - vmbr103 + - vmbr104 +vm_disk_size: + - 20G + - 32G + - 64G + - 96G + - 128G + - 196G + - 256G +vm_memory: + - 1024 + - 2048 + - 4096 + - 8192 \ No newline at end of file diff --git a/variables.tf b/variables.tf index ef383ac..7948ddc 100644 --- a/variables.tf +++ b/variables.tf @@ -104,6 +104,11 @@ variable "vm_memory" { default = 4096 type = number description = "amount of memory of the vm" + + validation { + condition = contains([1024, 2048, 4096, 8192], var.vm_memory) + error_message = "Valid values for vm_memory are (1024, 2048, 4096, 8192)" + } } variable "vm_disk_size" {