Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Go to tests dir #13

Merged
merged 2 commits into from
Mar 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/vm-creation-terraform.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:
def write_file(testVars, output_file_name):
environment = Environment(loader=FileSystemLoader("tests/templates/"))
template = environment.get_template("module.tpl")
filename = "main.tf"
filename = "terraform.tfvars"
content = template.render(
name = output_file_name,
vm_count = random.choice(testVars['vm_count']),
Expand Down Expand Up @@ -77,8 +77,8 @@ jobs:
- name: Upload main.tf file for job 2
uses: actions/upload-artifact@v4
with:
name: terraform_main
path: main.tf
name: terraform_vars
path: terraform.tfvars

test-terraform-apply:
needs: build-terraform-file
Expand All @@ -93,7 +93,7 @@ jobs:
- name: Download main
uses: actions/download-artifact@v4
with:
name: terraform_main
name: terraform_vars

- run: |
terraform init
Expand Down
59 changes: 59 additions & 0 deletions tests/templates/module copy.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
module "proxmox-vm" {
source = "git::https://github.com/stuttgart-things/proxmox-vm.git"
#source = "../../repos/proxmox-vm"
pve_api_url = var.pve_api_url
pve_api_user = var.pve_api_user
pve_api_password = var.pve_api_password
pve_api_tls_verify = var.pve_api_tls_verify

pve_cluster_node = "sthings-pve1"
pve_datastore = "{{ pve_datastore }}"
pve_folder_path = "stuttgart-things"
pve_network = "vmbr103"
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_ssh_user = var.vm_ssh_user
vm_ssh_password = var.vm_ssh_password
}

output "ip" {
value = module.proxmox-vm.ip
}

output "mac" {
value = module.proxmox-vm.mac
}

output "id" {
value = module.proxmox-vm.id
}


variable "pve_api_url" {
description = "url of proxmox api"
}

variable "pve_api_user" {
description = "username of proxmox api user"
}

variable "pve_api_password" {
description = "password of proxmox api user"
}

variable "vm_ssh_user" {
description = "username of proxmox api user"
}

variable "vm_ssh_password" {
description = "password of proxmox api user"
}

variable "pve_api_tls_verify" {
description = "proxmox API disable check if cert is valid"
}
70 changes: 11 additions & 59 deletions tests/templates/module.tpl
Original file line number Diff line number Diff line change
@@ -1,59 +1,11 @@
module "proxmox-vm" {
source = "git::https://github.com/stuttgart-things/proxmox-vm.git"
#source = "../../repos/proxmox-vm"
pve_api_url = var.pve_api_url
pve_api_user = var.pve_api_user
pve_api_password = var.pve_api_password
pve_api_tls_verify = var.pve_api_tls_verify

pve_cluster_node = "sthings-pve1"
pve_datastore = "{{ pve_datastore }}"
pve_folder_path = "stuttgart-things"
pve_network = "vmbr103"
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_ssh_user = var.vm_ssh_user
vm_ssh_password = var.vm_ssh_password
}

output "ip" {
value = module.proxmox-vm.ip
}

output "mac" {
value = module.proxmox-vm.mac
}

output "id" {
value = module.proxmox-vm.id
}


variable "pve_api_url" {
description = "url of proxmox api"
}

variable "pve_api_user" {
description = "username of proxmox api user"
}

variable "pve_api_password" {
description = "password of proxmox api user"
}

variable "vm_ssh_user" {
description = "username of proxmox api user"
}

variable "vm_ssh_password" {
description = "password of proxmox api user"
}

variable "pve_api_tls_verify" {
description = "proxmox API disable check if cert is valid"
}
pve_cluster_node = "sthings-pve1"
pve_datastore = "{{ pve_datastore }}"
pve_folder_path = "stuttgart-things"
pve_network = "vmbr103"
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"