yascoo

New Member
Jun 10, 2024
2
0
1
Hello everyone,

I am contacting support because I am encountering a persistent error when creating a VM via API and Terraform. To be more specific, my goal is to clone a specific VM from a template. My code is below. However, an error constantly appears, interrupting the process with "error 599: too many redirections." I have tried with other providers, but the problem persists.

Thank you for your assistance.


#!/bin/bash

echo "user:" $1

cd /home/yasco/pentesting-platform/config/terraform/utilisateur
mkdir -p user-$1
cd user-$1

cat > main.tf <<EOF
terraform {
required_providers {
proxmox = {
source = "Telmate/proxmox"
version = "3.0.1-rc3"
}
}
}

provider "proxmox" {
pm_api_url = "https://11.11.11.11:8006/api2/json"
pm_api_token_id = "XXXXX"
pm_api_token_secret = "XXXXXXX"
pm_tls_insecure = true
pm_log_enable = true
pm_log_file = "terraform-plugin-proxmox.log"
pm_debug = true
pm_log_levels = {
_default = "debug"
_capturelog = ""
}
}

resource "proxmox_vm_qemu" "pwnbox_template" {
name = "pwnbox-user-$1"
target_node = "pve"
clone = "pwnbox-template1"
boot = "order=scsi0;net0"
memory = "6000"
bootdisk = "scsi0"
cores = 2
sockets = 2
cpu = "kvm64"



disks {
scsi {
scsi0 {
disk {
size = "40G"
storage = "local-lvm"


}

}
}
}

ipconfig0 = "ip=11.11.11.$1/24,gw=11.11.11.2"
}



EOF

terraform init -upgrade
terraform apply -auto-approve
 
Perfect. I have raised an internal Service ticket for our IT to update the affected cluster. I´ll let you know if this works for us
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!