summaryrefslogtreecommitdiff
path: root/main.tf
blob: f555b42bd850e6818fceaa82ba2f7833c5c2e40a (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
terraform {
  required_providers {
    proxmox = {
      source  = "telmate/proxmox"
      version = ">=2.0.0"
    }
  }
}

provider "proxmox" {
  # Configuration options
  #pm_tls_insecure = true
  pm_api_url      = "https://pve.xlinfo.fr:8006/api2/json"
  #pm_user         = "root@pam"
  #pm_password     = "secret"
  pm_api_token_id   = "root@pam!terraform"
  pm_api_token_secret  = "350039e6-3f20-4fc2-856d-xxxxd7d"
}

resource "proxmox_lxc" "basic" {
  target_node  = "pve"
  hostname     = "alpine"
  ostemplate   = "local:vztmpl/alpine-3.17-default_20221129_amd64.tar.xz"
  password     = "secret"
  unprivileged = true
  start = true

  // Terraform will crash without rootfs defined
  rootfs {
    storage = "local-lvm"
    size    = "8G"
  }

  network {
    name   = "eth0"
    bridge = "vmbr0"
    ip     = "dhcp"
  }
}