TerraSemaphore

This commit is contained in:
Zakaria 2024-08-27 19:25:09 +00:00
parent 028f7f67a2
commit f74e16719a
4 changed files with 71 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
credentials.auto.tfvars

View File

@ -0,0 +1,5 @@
proxmox_api_url= "https://192.168.1.155:8006/api2/json"
proxmox_api_token_id= "root@pam!TerraDemo"
proxmox_api_token_secret= "4f6c33d0-7a29-4238-815c-ad7d368dae66"
root_password = "Zakaria1986!!!"
ssh_public_key = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIO65p1xPly/h1Pso+G44zFnIBX2x7OfrZkXIb22JmW8J k_ansible"

View File

@ -0,0 +1,27 @@
resource "proxmox_lxc" "TerraformDemo" {
target_node = "ThePearl"
hostname = "lxc-SemaTerra"
ostemplate = "local:vztmpl/ubuntu-24.04-standard_24.04-2_amd64.tar.zst"
password = var.root_password
unprivileged = true
memory = 2048
swap = 512
cores = 2
cpulimit = 2
ssh_keys = [
var.ssh_public_key
]
// Terraform will crash without rootfs defined
rootfs {
storage = "TheTower"
size = "4G"
}
network {
name = "eth0"
bridge = "vmbr0"
ip = "dhcp"
}
}

View File

@ -0,0 +1,38 @@
terraform {
required_version = ">=0.14"
required_providers {
proxmox = {
source = "Telmate/proxmox"
version = "3.0.1-rc1"
}
}
}
variable "root_password" {
type = string
sensitive = true
}
variable "ssh_public_key" {
type = string
sensitive = true
}
variable "proxmox_api_url" {
type = string
}
variable "proxmox_api_token_id" {
type = string
sensitive = true
}
variable "proxmox_api_token_secret" {
type = string
sensitive = true
}
provider "proxmox" {
pm_tls_insecure = true
pm_api_url = var.proxmox_api_url
pm_api_token_id = var.proxmox_api_token_id
pm_api_token_secret= var.proxmox_api_token_secret
}