feat: add variable master and worker counts
This commit is contained in:
+3
-7
@@ -3,14 +3,10 @@
|
|||||||
# ------
|
# ------
|
||||||
|
|
||||||
locals {
|
locals {
|
||||||
|
image = "ubuntu/26.04"
|
||||||
root_disk_size = "16GiB"
|
root_disk_size = "16GiB"
|
||||||
ext_disk_size = "16GiB"
|
ext_disk_size = "16GiB"
|
||||||
network_cidr = "10.150.0.1/24"
|
network_cidr = "10.150.0.1/24"
|
||||||
|
|
||||||
master_count = 3
|
|
||||||
worker_count = 0
|
|
||||||
|
|
||||||
image = "ubuntu/26.04"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# ---------
|
# ---------
|
||||||
@@ -46,7 +42,7 @@ resource "incus_network" "this" {
|
|||||||
|
|
||||||
module "master" {
|
module "master" {
|
||||||
source = "./modules/incus_vm"
|
source = "./modules/incus_vm"
|
||||||
count = local.master_count
|
count = var.master_count
|
||||||
|
|
||||||
name = "master-${count.index}"
|
name = "master-${count.index}"
|
||||||
project = incus_project.this.name
|
project = incus_project.this.name
|
||||||
@@ -60,7 +56,7 @@ module "master" {
|
|||||||
|
|
||||||
module "worker" {
|
module "worker" {
|
||||||
source = "./modules/incus_vm"
|
source = "./modules/incus_vm"
|
||||||
count = local.worker_count
|
count = var.worker_count
|
||||||
|
|
||||||
name = "worker-${count.index}"
|
name = "worker-${count.index}"
|
||||||
project = incus_project.this.name
|
project = incus_project.this.name
|
||||||
|
|||||||
@@ -1,3 +1,17 @@
|
|||||||
|
variable "master_count" {
|
||||||
|
description = "The number of master nodes to provision."
|
||||||
|
type = number
|
||||||
|
default = 1
|
||||||
|
nullable = false
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "worker_count" {
|
||||||
|
description = "The number of worker nodes to provision."
|
||||||
|
type = number
|
||||||
|
default = 0
|
||||||
|
nullable = false
|
||||||
|
}
|
||||||
|
|
||||||
variable "cpus" {
|
variable "cpus" {
|
||||||
description = "The number of CPU cores allocated to each virtual machine."
|
description = "The number of CPU cores allocated to each virtual machine."
|
||||||
type = number
|
type = number
|
||||||
|
|||||||
Reference in New Issue
Block a user