change tf to use vars
This commit is contained in:
parent
124f835662
commit
d84e3b0669
2 changed files with 29 additions and 7 deletions
|
|
@ -1,18 +1,19 @@
|
||||||
resource "proxmox_virtual_environment_container" "disposable_lxc" {
|
resource "proxmox_virtual_environment_container" "managed_lxc" {
|
||||||
node_name = "pve1" # Which physical server to put it on
|
node_name = var.target_node
|
||||||
vm_id = 201
|
vm_id = var.lxc_id
|
||||||
|
|
||||||
initialization {
|
initialization {
|
||||||
hostname = "pve2-lxc1"
|
hostname = var.lxc_hostname
|
||||||
ip_config {
|
ip_config {
|
||||||
ipv4 {
|
ipv4 {
|
||||||
address = "172.16.201.201/24"
|
# We can even variablize the IP if you want!
|
||||||
|
address = "172.16.201.${var.lxc_id}/24"
|
||||||
gateway = "172.16.201.1"
|
gateway = "172.16.201.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
clone {
|
clone {
|
||||||
vm_id = 9000 # YOUR GOLDEN IMAGE ID
|
vm_id = var.source_template_id
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,3 +1,24 @@
|
||||||
variable "pve_endpoint" { type = string }
|
variable "pve_endpoint" { type = string }
|
||||||
variable "pve_token_id" { type = string }
|
variable "pve_token_id" { type = string }
|
||||||
variable "pve_token_secret" { type = string; sensitive = true }
|
variable "pve_token_secret" { type = string; sensitive = true }
|
||||||
|
|
||||||
|
# Infrastructure Settings
|
||||||
|
variable "target_node" {
|
||||||
|
type = string
|
||||||
|
default = "pve1"
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "lxc_id" {
|
||||||
|
type = number
|
||||||
|
description = "The ID of the new LXC (e.g., 201)"
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "source_template_id" {
|
||||||
|
type = number
|
||||||
|
default = 9000
|
||||||
|
description = "The ID of your Golden Image"
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "lxc_hostname" {
|
||||||
|
type = string
|
||||||
|
}
|
||||||
Loading…
Reference in a new issue