Skip to content

rgl/terraform-proxmox-ubuntu-example

Repository files navigation

Usage (from a Ubuntu 24.04 host)

Lint

Create and install the base Ubuntu 24.04 template.

Install the dependencies:

Open this directory with the Dev Container plugin.

Open bash inside the Visual Studio Code Terminal.

Set your proxmox details:

# see https://registry.terraform.io/providers/bpg/proxmox/latest/docs#argument-reference
# see https://github.com/bpg/terraform-provider-proxmox/blob/v0.90.0/proxmoxtf/provider/provider.go#L52-L61
cat >secrets-proxmox.sh <<EOF
unset HTTPS_PROXY
#export HTTPS_PROXY='http://localhost:8080'
export TF_VAR_proxmox_pve_node_address='192.168.1.21'
export PROXMOX_VE_INSECURE='1'
export PROXMOX_VE_ENDPOINT="https://$TF_VAR_proxmox_pve_node_address:8006"
export PROXMOX_VE_USERNAME='root@pam'
export PROXMOX_VE_PASSWORD='vagrant'
EOF
source secrets-proxmox.sh

Create the infrastructure:

export CHECKPOINT_DISABLE='1'
export TF_LOG='DEBUG' # TRACE, DEBUG, INFO, WARN or ERROR.
export TF_LOG_PATH='terraform.log'
rm -f "$TF_LOG_PATH"
terraform init
terraform plan -out=tfplan
time terraform apply tfplan

Login into the machine:

ssh-keygen -f ~/.ssh/known_hosts -R "$(terraform output --raw ip)"
ssh "vagrant@$(terraform output --raw ip)"

Destroy the infrastructure:

time terraform destroy -auto-approve

List this repository dependencies (and which have newer versions):

export GITHUB_COM_TOKEN='YOUR_GITHUB_PERSONAL_TOKEN'
./renovate.sh

About

example on how to launch a ubuntu vm using terraform in proxmox

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors