diff --git a/terraform/main.tf b/terraform/main.tf index ad8fddf..3753435 100644 --- a/terraform/main.tf +++ b/terraform/main.tf @@ -2,10 +2,18 @@ resource "openstack_compute_instance_v2" "services_instance" { name = "${terraform.workspace}-ood-services" flavor_id = var.services_flavor_id - image_id = var.services_image_id key_pair = var.key_pair security_groups = ["default", "ssh-allow-all", "https", "http"] + block_device { + uuid = var.services_image_id + source_type = "image" + destination_type = "volume" + boot_index = 0 + volume_size = var.services_volume_size + delete_on_termination = true + } + network { name = var.tenant_name } @@ -38,42 +46,22 @@ resource "null_resource" "services_extra_keys" { } } -# copy kube config and cloud.yaml -# resource "null_resource" "services_kube_cloud" { -# depends_on = [openstack_compute_floatingip_associate_v2.services_floating_ip_association] - -# connection { -# user = var.vm_user -# private_key = file(var.key_file) -# host = "${openstack_networking_floatingip_v2.services_floating_ip.address}" -# } - -# provisioner "remote-exec" { -# inline = [ -# "mkdir -p ~/.kube", -# "mkdir -p ~/.config/openstack", -# ] -# } - -# provisioner "file" { -# source = var.clouds_yaml -# destination = "/home/${var.vm_user}/.config/openstack/clouds.yaml" -# } - -# provisioner "file" { -# source = var.kube_config -# destination = "/home/${var.vm_user}/.kube/config" -# } -# } - # Create webnode instance resource "openstack_compute_instance_v2" "webnode_instance" { name = "${terraform.workspace}-ood-webnode" flavor_id = var.webnode_flavor_id - image_id = var.webnode_image_id key_pair = var.key_pair security_groups = ["default", "ssh-allow-all", "https", "http"] + block_device { + uuid = var.webnode_image_id + source_type = "image" + destination_type = "volume" + boot_index = 0 + volume_size = var.webnode_volume_size + delete_on_termination = true + } + network { name = var.tenant_name } diff --git a/terraform/terraform.tfvars.example b/terraform/terraform.tfvars.example index 5280276..dede917 100644 --- a/terraform/terraform.tfvars.example +++ b/terraform/terraform.tfvars.example @@ -1,2 +1,5 @@ key_pair = "NeSI_RDC_KEYPAIR_NAME" key_file = "/path/to/nesi-rdc/private_key" + +services_volume_size = 30 +webnode_volume_size = 30 diff --git a/terraform/variables.tf b/terraform/variables.tf index fc53626..ea5d552 100644 --- a/terraform/variables.tf +++ b/terraform/variables.tf @@ -33,6 +33,11 @@ variable "services_image_id" { default = "1a0480d1-55c8-4fd7-8c7a-8c26e52d8cbd" } +variable "services_volume_size" { + description = "The size of the services volume in gigabytes, defaults to 30" + default = "30" +} + variable "webnode_flavor_id" { description = "FlexiHPC Flavor ID for services instance, Defaults to balanced1.4cpu8ram" # default = "e07cfee1-43af-4bf6-baac-3bdf7c1b88f8" @@ -44,6 +49,11 @@ variable "webnode_image_id" { default = "1a0480d1-55c8-4fd7-8c7a-8c26e52d8cbd" } +variable "webnode_volume_size" { + description = "The size of the webnode volume in gigabytes, defaults to 30" + default = "30" +} + variable "vm_user" { description = "FlexiHPC VM user" default = "ubuntu"