summaryrefslogtreecommitdiff
path: root/main.tf
blob: 432f8fd7ae3e8f4748dea33c6214620ec67e6191 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
terraform {
  required_providers {
    proxmox = {
      source = "telmate/proxmox"
      version = "3.0.2-rc04"
    }
  }
}

provider "proxmox" {
  pm_api_url = "https://192.168.1.45:8006/api2/json"
  pm_tls_insecure = true
  #pm_api_token_id = "terraform-prov@pve!terraform"
  #pm_api_token_secret = "64bd4ba4-f4c0-4029-9f16-5b61bca2da0d"
  pm_user = "terraform-prov@pve"
  pm_password = "terraform"
  pm_debug = true
}

resource "proxmox_lxc" "test" {
  target_node = "atlas" # "tl-core02"
  hostname    = "test" # "training-xxx"
  ostemplate  = "local:vztmpl/alpine-3.21-default_20241217_amd64.tar.xz"

  unprivileged = true
  password     = "test1"

  cores   = 1
  memory  = 512
  swap    = 512

  rootfs {
    storage = "local-lvm"
    size    = "4G"
  }

  network {
    name   = "eth0"
    bridge = "vmbr0"
    ip     = "dhcp"
    #gw   = "192.168.1.1"
  }

  # ssh_public_keys = file("~/.ssh/id_rsa.pub")

  start = true
  #tags  = "tofu,lxc"
}