From 02d2bd03f6b29da590dbc4e1880b14dfc5d11fa6 Mon Sep 17 00:00:00 2001 From: Matt Reeves Date: Sun, 2 Jun 2024 22:49:26 -0400 Subject: [PATCH] adding test-vm --- .gitignore | 40 ++++++++++++++++++++++++++++++++++++++++ provider.tf | 28 ++++++++++++++++++++++++++++ test-vm.tf | 41 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 109 insertions(+) create mode 100644 .gitignore create mode 100644 provider.tf create mode 100644 test-vm.tf diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..cfbec79 --- /dev/null +++ b/.gitignore @@ -0,0 +1,40 @@ +# Local .terraform directories +**/.terraform/* + +# .tfstate files +*.tfstate +*.tfstate.* + +# Crash log files +crash.log +crash.*.log + +# Exclude all .tfvars files, which are likely to contain sensitive data, such as +# password, private keys, and other secrets. These should not be part of version +# control as they are data points which are potentially sensitive and subject +# to change depending on the environment. +*.tfvars +*.tfvars.json + +# Ignore override files as they are usually used to override resources locally and so +# are not checked in +override.tf +override.tf.json +*_override.tf +*_override.tf.json + +# Ignore transient lock info files created by terraform apply +.terraform.tfstate.lock.info + +# Include override files you do wish to add to version control using negated pattern +# !example_override.tf + +# Include tfplan files to ignore the plan output of command: terraform plan -out=tfplan +# example: *tfplan* + +# Ignore CLI configuration files +.terraformrc +terraform.rc + +# Ignore hcl file +.terraform.lock.hcl \ No newline at end of file diff --git a/provider.tf b/provider.tf new file mode 100644 index 0000000..8cc9922 --- /dev/null +++ b/provider.tf @@ -0,0 +1,28 @@ +# Proxmox Provider +# --- +# Initial Provider Configuration for Proxmox + +terraform { + + required_providers { + proxmox = { + source = "bpg/proxmox" + version = ">= 0.58.1" + } + } +} + +provider "proxmox" { + endpoint = var.virtual_environment_endpoint + api_token = var.virtual_environment_api + insecure = true + +} + +variable "virtual_environment_endpoint" { + type = string +} + +variable "virtual_environment_api" { + type = string +} \ No newline at end of file diff --git a/test-vm.tf b/test-vm.tf new file mode 100644 index 0000000..9444352 --- /dev/null +++ b/test-vm.tf @@ -0,0 +1,41 @@ +resource "proxmox_virtual_environment_vm" "virtual_machine" { + + # VM General Settings + node_name = "prox" + vm_id = 7500 + name = "vtest-vm" + description = "Open Tofu test" + + agent { + # read 'Qemu guest agent' section, change to true only when ready + enabled = false + } + + clone { + vm_id = 8000 + } + + # VM CPU Settings + cpu { + cores = 2 + type = "host" + } + + # VM Memory Settings + memory { + dedicated = 2048 + } + + # VM Network Settings + network_device { + bridge = "vmbr0" + vlan_id = 1 + } + + # VM Disk Settings + disk { + datastore_id = "Fast2Tb" + size = 20 + interface = "scsi0" + } +}