diff --git a/.forgejo/workflows/tofu-issue-deploy.yml b/.forgejo/workflows/tofu-issue-deploy.yml index fc68806..5f82984 100644 --- a/.forgejo/workflows/tofu-issue-deploy.yml +++ b/.forgejo/workflows/tofu-issue-deploy.yml @@ -17,7 +17,7 @@ jobs: echo "Extracting issue details..." ISSUE_BODY="${{ github.event.issue.body }}" VM_NAME=$(echo "$ISSUE_BODY" | grep -A 2 'VM Name' | tail -n 1 | xargs) - VM_ID=$(echo "$ISSUE_BODY" | grep -A 2 'VM ID' | tail -n 1 | xargs) + VM_ID=$(echo "$ISSUE_BODY" | grep -A 2 'VM ID' | grep -v 'Clone VM ID' | tail -n 1 | xargs) RAM=$(echo "$ISSUE_BODY" | grep -A 2 'RAM' | tail -n 1 | xargs) CPUS=$(echo "$ISSUE_BODY" | grep -A 2 'CPU Cores' | tail -n 1 | xargs) SCPU_TYPE=$(echo "$ISSUE_BODY" | grep -A 2 'CPU Type' | tail -n 1 | xargs) @@ -100,3 +100,15 @@ jobs: git add terraform/proxmox/$VM_NAME.tf git commit -m "Add VM $VM_NAME configuration" git push + + + - name: Trigger Terraform Apply Workflow + uses: https://github.com/actions/github-script@v6 + with: + script: | + github.rest.actions.createWorkflowDispatch({ + owner: context.repo.owner, + repo: context.repo.repo, + workflow_id: "tofu.yml", + ref: "main" + }) \ No newline at end of file diff --git a/terraform/proxmox/test.tf b/terraform/proxmox/test.tf deleted file mode 100644 index c65620c..0000000 --- a/terraform/proxmox/test.tf +++ /dev/null @@ -1,39 +0,0 @@ -resource "proxmox_virtual_environment_vm" "test" { - node_name = "prox" - vm_id = "9996" - name = "test" - description = "test" - - cpu { - cores = "2" - type = "host" - } - - memory { - dedicated = "2048" - } - - network_device { - bridge = "vmbr0" - vlan_id = "1" - } - - disk { - datastore_id = "Fast2Tb" - size = "20" - } - - clone { - vm_id = "9996" - } - - initialization { - ip_config { - ipv4 { - address = "dhcp" - } - } - - user_data_file_id = proxmox_virtual_environment_file.cloud_config.id - } -}