add first terraform project with bpg-proxmox (not working)
This commit is contained in:
parent
5ac27af6cb
commit
52c5f36e86
4
.gitignore
vendored
Normal file
4
.gitignore
vendored
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
# Terraform
|
||||||
|
**/.terraform*
|
||||||
|
*.tfstate*
|
||||||
|
*credentials.auto.tfvars
|
64
terraform/bgp-simple-vm/bpg-simple-vm.tf
Normal file
64
terraform/bgp-simple-vm/bpg-simple-vm.tf
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
data "proxmox_virtual_environment_vms" "template" {
|
||||||
|
filter {
|
||||||
|
name = "name"
|
||||||
|
values = ["ubuntu-cloud"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
resource "proxmox_virtual_environment_vm" "simple_vm" {
|
||||||
|
name = "simple-vm"
|
||||||
|
node_name = "zenith"
|
||||||
|
tags = ["terraform", "test"]
|
||||||
|
|
||||||
|
|
||||||
|
agent {
|
||||||
|
enabled = false
|
||||||
|
}
|
||||||
|
# if agent is not enabled, the VM may not be able to shutdown properly, and may need to be forced off
|
||||||
|
stop_on_destroy = true
|
||||||
|
|
||||||
|
clone {
|
||||||
|
vm_id = data.proxmox_virtual_environment_vms.template.vms[0].vm_id
|
||||||
|
}
|
||||||
|
|
||||||
|
cpu {
|
||||||
|
cores = 2
|
||||||
|
type = "x86-64-v2-AES" # recommended for modern CPUs
|
||||||
|
}
|
||||||
|
|
||||||
|
memory {
|
||||||
|
dedicated = 2048
|
||||||
|
floating = 2048 # set equal to dedicated to enable ballooning
|
||||||
|
}
|
||||||
|
|
||||||
|
disk {
|
||||||
|
datastore_id = "ceph-workload"
|
||||||
|
#file_id = proxmox_virtual_environment_download_file.latest_ubuntu_22_jammy_qcow2_img.id
|
||||||
|
interface = "scsi0"
|
||||||
|
}
|
||||||
|
|
||||||
|
initialization {
|
||||||
|
ip_config {
|
||||||
|
ipv4 {
|
||||||
|
address = "dhcp"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#user_account {
|
||||||
|
# keys = [trimspace(tls_private_key.ubuntu_vm_key.public_key_openssh)]
|
||||||
|
# password = random_password.ubuntu_vm_password.result
|
||||||
|
# username = "ubuntu"
|
||||||
|
#}
|
||||||
|
|
||||||
|
#user_data_file_id = proxmox_virtual_environment_file.cloud_config.id
|
||||||
|
}
|
||||||
|
|
||||||
|
network_device {
|
||||||
|
bridge = "vmbr0"
|
||||||
|
}
|
||||||
|
|
||||||
|
operating_system {
|
||||||
|
type = "l26"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
17
terraform/bgp-simple-vm/provider.tf
Normal file
17
terraform/bgp-simple-vm/provider.tf
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
terraform {
|
||||||
|
required_providers {
|
||||||
|
proxmox = {
|
||||||
|
source = "bpg/proxmox"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
provider "proxmox" {
|
||||||
|
endpoint = var.proxmox_endpoint
|
||||||
|
api_token = var.proxmox_api_token
|
||||||
|
insecure = false
|
||||||
|
ssh {
|
||||||
|
agent = true
|
||||||
|
username = "root"
|
||||||
|
}
|
||||||
|
}
|
10
terraform/bgp-simple-vm/variables.tf
Normal file
10
terraform/bgp-simple-vm/variables.tf
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
variable "proxmox_endpoint" {
|
||||||
|
description = "Proxmox URL endpoint"
|
||||||
|
type = string
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "proxmox_api_token" {
|
||||||
|
description = "Proxmox API token"
|
||||||
|
type = string
|
||||||
|
sensitive = true
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user