2024-04-12 08:01:51 +00:00
|
|
|
# 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"
|
|
|
|
}
|
|
|
|
|
2024-04-16 08:12:45 +00:00
|
|
|
resource "openstack_compute_instance_v2" "controller-nodes" {
|
|
|
|
count = var.controller_instance_count
|
|
|
|
name = "${var.controller_name}-${count.index}.${var.dns_suffix}"
|
|
|
|
flavor_name = "${var.controller_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"
|
|
|
|
}
|
|
|
|
}
|
2024-04-12 08:01:51 +00:00
|
|
|
resource "openstack_compute_instance_v2" "worker-nodes" {
|
2024-04-16 08:12:45 +00:00
|
|
|
count = var.worker_instance_count
|
2024-04-12 08:01:51 +00:00
|
|
|
name = "${var.worker_name}-${count.index}.${var.dns_suffix}"
|
2024-04-16 08:12:45 +00:00
|
|
|
flavor_name = "${var.worker_instance_type}"
|
2024-04-12 08:01:51 +00:00
|
|
|
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"
|
|
|
|
}
|
|
|
|
}
|