Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ resource "openstack_compute_instance_v2" "cogstack_ops_compute" {
}

block_device {
uuid = data.openstack_images_image_v2.ubuntu.id
uuid = each.value.image_uuid == null ? data.openstack_images_image_v2.ubuntu.id : each.value.image_uuid
source_type = "image"
volume_size = each.value.volume_size
boot_index = 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ output "compute_keypair" {
}

output "created_security_group" {
value = openstack_networking_secgroup_v2.cogstack_apps_security_group
value = openstack_networking_secgroup_v2.cogstack_apps_security_group
description = "Security group associated to the created hosts"
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

locals {
random_prefix = random_id.server.b64_url
random_prefix = random_id.server.b64_url
output_file_directory = var.output_file_directory != null ? var.output_file_directory : "${path.root}/.build"
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,14 @@ name = Human readable hostname for this host.
is_controller = Must be true for exactly one host. This will run the portainer "controller". All other nodes run the portainer "agent".
flavour = The openstack_compute_flavor_v2 for the host
volume_size = Size in GB for the disk volume for the node
image_uuid = (Optional) The Openstack image you want to run, to override the default in ubuntu_immage_name
EOT
type = list(object({
name = string,
flavour = optional(string, "2cpu4ram"),
volume_size = optional(number, 20),
is_controller = optional(bool, false)
is_controller = optional(bool, false),
image_uuid = optional(string, null)
}))

default = [
Expand Down Expand Up @@ -70,11 +72,11 @@ EOT

variable "allowed_security_group_rules" {
type = list(object({
port = number
cidr = string
description = string
port = number
cidr = string
description = string
}))
default = [ ]
default = []
description = <<EOT
Optionally provide additional security group rules to allow ingress to the created hosts

Expand Down Expand Up @@ -103,7 +105,7 @@ variable "ssh_key_pair" {


variable "output_file_directory" {
type = string
default = null
type = string
default = null
description = "Optional path to write output files to. If directory doesnt exist it will be created"
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@


resource "openstack_compute_instance_v2" "kubernetes_server" {

name = "${local.random_prefix}-${local.controller_host.name}"
Expand All @@ -17,7 +15,7 @@ resource "openstack_compute_instance_v2" "kubernetes_server" {
}

block_device {
uuid = data.openstack_images_image_v2.ubuntu.id
uuid = local.controller_host.image_uuid == null ? data.openstack_images_image_v2.ubuntu.id : local.controller_host.image_uuid
source_type = "image"
volume_size = local.controller_host.volume_size
boot_index = 0
Expand Down Expand Up @@ -56,7 +54,7 @@ resource "openstack_compute_instance_v2" "kubernetes_nodes" {
}

block_device {
uuid = data.openstack_images_image_v2.ubuntu.id
uuid = each.value.image_uuid == null ? data.openstack_images_image_v2.ubuntu.id : each.value.image_uuid
source_type = "image"
volume_size = each.value.volume_size
boot_index = 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ EOT
}

data "local_file" "kubeconfig_file" {
filename = local.kubeconfig_file
depends_on = [ null_resource.copy_kubeconfig ]
filename = local.kubeconfig_file
depends_on = [null_resource.copy_kubeconfig]
}
output "kubeconfig_raw" {
value = data.local_file.kubeconfig_file.content
value = data.local_file.kubeconfig_file.content
description = "Kubeconfig for this cluster"
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,14 @@ name = Human readable hostname for this host.
is_controller = Must be true for exactly one host. This will run the k3s "server". All other nodes run the k3s "agent".
flavour = The openstack_compute_flavor_v2 for the host
volume_size = Size in GB for the disk volume for the node
image_uuid = (Optional) The Openstack image you want to run, to override the default in ubuntu_immage_name
EOT
type = list(object({
name = string,
flavour = optional(string, "2cpu4ram"),
volume_size = optional(number, 20),
is_controller = optional(bool, false)
is_controller = optional(bool, false),
image_uuid = optional(string, null)
}))

default = [
Expand Down