Add tofu manifests for setting up workers.

This commit is contained in:
Mikael Frykholm 2024-04-12 10:01:51 +02:00
parent 51a0e01cf0
commit 3a22da7ee3
Signed by: mifr
GPG key ID: 1467F9D69135C236
2 changed files with 49 additions and 0 deletions

36
main.tf Normal file
View file

@ -0,0 +1,36 @@
# Define required providers
terraform {
required_version = ">= 0.14.0"
required_providers {
openstack = {
source = "terraform-provider-openstack/openstack"
version = "~> 1.53.0"
}
}
}
# Configure the OpenStack Provider
provider "openstack" {
cloud = "sto4-rut"
}
resource "openstack_compute_instance_v2" "worker-nodes" {
count = var.instance_count
name = "${var.worker_name}-${count.index}.${var.dns_suffix}"
flavor_id = "${var.instance_type}"
key_pair = "mifr-yubi"
security_groups = ["microk8s", "Allow SSH from SUNET jumphosts", "Allow ssh from the world"]
block_device {
uuid = "5d24aca9-11be-4de1-9770-4a097d68f361"
source_type = "image"
volume_size = 20
boot_index = 0
destination_type = "volume"
delete_on_termination = true
}
network {
name = "public"
}
}

13
vars.tf Normal file
View file

@ -0,0 +1,13 @@
variable "instance_count" {
default = "6"
}
variable "instance_type" {
default = "e2677a72-f9ab-44ce-b808-58ab3414bac6"
}
variable "worker_name" {
default = "internal-sto4-test-k8sw"
}
variable "dns_suffix" {
default = "rut.sunet.se"
}