Skip to content

Commit

Permalink
chore: add memory and vcpu variables to terraform
Browse files Browse the repository at this point in the history
These can be overridden with -var="name=$value" via the cmdline.
  • Loading branch information
tiagolobocastro committed Jun 9, 2021
1 parent 8cfc6b9 commit 7cb69a0
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 2 deletions.
2 changes: 2 additions & 0 deletions terraform/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ module "provider" {
ssh_user = var.ssh_user
ssh_key = var.ssh_key
num_nodes = var.num_nodes
memory = var.memory
vcpu = var.vcpu

# libvirt
image_path = var.image_path
Expand Down
10 changes: 8 additions & 2 deletions terraform/mod/libvirt/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ variable "image_path" {
variable "num_nodes" {
}

variable "memory" {
}

variable "vcpu" {
}

variable "hostname_formatter" {
}

Expand Down Expand Up @@ -81,8 +87,8 @@ resource "libvirt_cloudinit_disk" "commoninit" {
resource "libvirt_domain" "ubuntu-domain" {
count = var.num_nodes
name = format(var.hostname_formatter, count.index + 1)
memory = 4096
vcpu = 2
memory = var.memory
vcpu = var.vcpu
autostart = true

cloudinit = libvirt_cloudinit_disk.commoninit[count.index].id
Expand Down
6 changes: 6 additions & 0 deletions terraform/mod/lxd/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ variable "num_nodes" {
default = 3
}

variable "memory" {
}

variable "vcpu" {
}

resource "lxd_cached_image" "ubuntu" {
source_remote = "ubuntu"
source_image = "bionic/amd64"
Expand Down
12 changes: 12 additions & 0 deletions terraform/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,18 @@ variable "nr_hugepages" {
default = "512"
}

variable "memory" {
type = number
default = 4096
description = "Amount of memory (MiB) allocated to each node - only needed for libvirt provider"
}

variable "vcpu" {
type = number
default = 2
description = "Virtual CPUs allocated to each node - only needed for libvirt provider"
}

variable "modprobe_nvme" {
type = string
description = "modprobe nvme tcp selector for node.sh"
Expand Down

0 comments on commit 7cb69a0

Please sign in to comment.