File tree Expand file tree Collapse file tree 7 files changed +20
-18
lines changed
deployment/terraform/modules
openstack-kubernetes-infra Expand file tree Collapse file tree 7 files changed +20
-18
lines changed Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ resource "openstack_compute_instance_v2" "cogstack_ops_compute" {
1717 }
1818
1919 block_device {
20- uuid = data. openstack_images_image_v2 . ubuntu . id
20+ uuid = each . value . image_uuid == null ? data. openstack_images_image_v2 . ubuntu . id : each . value . image_uuid
2121 source_type = " image"
2222 volume_size = each. value . volume_size
2323 boot_index = 0
Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ output "compute_keypair" {
2222}
2323
2424output "created_security_group" {
25- value = openstack_networking_secgroup_v2. cogstack_apps_security_group
25+ value = openstack_networking_secgroup_v2. cogstack_apps_security_group
2626 description = " Security group associated to the created hosts"
2727}
2828
Original file line number Diff line number Diff line change 11
22locals {
3- random_prefix = random_id. server . b64_url
3+ random_prefix = random_id. server . b64_url
44 output_file_directory = var. output_file_directory != null ? var. output_file_directory : " ${ path . root } /.build"
55}
66
Original file line number Diff line number Diff line change @@ -29,12 +29,14 @@ name = Human readable hostname for this host.
2929is_controller = Must be true for exactly one host. This will run the portainer "controller". All other nodes run the portainer "agent".
3030flavour = The openstack_compute_flavor_v2 for the host
3131volume_size = Size in GB for the disk volume for the node
32+ image_uuid = (Optional) The Openstack image you want to run, to override the default in ubuntu_immage_name
3233EOT
3334 type = list (object ({
3435 name = string ,
3536 flavour = optional (string , " 2cpu4ram" ),
3637 volume_size = optional (number , 20 ),
37- is_controller = optional (bool , false )
38+ is_controller = optional (bool , false ),
39+ image_uuid = optional (string , null )
3840 }))
3941
4042 default = [
7072
7173variable "allowed_security_group_rules" {
7274 type = list (object ({
73- port = number
74- cidr = string
75- description = string
75+ port = number
76+ cidr = string
77+ description = string
7678 }))
77- default = [ ]
79+ default = []
7880 description = << EOT
7981Optionally provide additional security group rules to allow ingress to the created hosts
8082
@@ -103,7 +105,7 @@ variable "ssh_key_pair" {
103105
104106
105107variable "output_file_directory" {
106- type = string
107- default = null
108+ type = string
109+ default = null
108110 description = " Optional path to write output files to. If directory doesnt exist it will be created"
109111}
Original file line number Diff line number Diff line change 1-
2-
31resource "openstack_compute_instance_v2" "kubernetes_server" {
42
53 name = " ${ local . random_prefix } -${ local . controller_host . name } "
@@ -17,7 +15,7 @@ resource "openstack_compute_instance_v2" "kubernetes_server" {
1715 }
1816
1917 block_device {
20- uuid = data. openstack_images_image_v2 . ubuntu . id
18+ uuid = local . controller_host . image_uuid == null ? data. openstack_images_image_v2 . ubuntu . id : local . controller_host . image_uuid
2119 source_type = " image"
2220 volume_size = local. controller_host . volume_size
2321 boot_index = 0
@@ -56,7 +54,7 @@ resource "openstack_compute_instance_v2" "kubernetes_nodes" {
5654 }
5755
5856 block_device {
59- uuid = data. openstack_images_image_v2 . ubuntu . id
57+ uuid = each . value . image_uuid == null ? data. openstack_images_image_v2 . ubuntu . id : each . value . image_uuid
6058 source_type = " image"
6159 volume_size = each. value . volume_size
6260 boot_index = 0
Original file line number Diff line number Diff line change 1818}
1919
2020data "local_file" "kubeconfig_file" {
21- filename = local. kubeconfig_file
22- depends_on = [ null_resource. copy_kubeconfig ]
21+ filename = local. kubeconfig_file
22+ depends_on = [null_resource. copy_kubeconfig ]
2323}
2424output "kubeconfig_raw" {
25- value = data. local_file . kubeconfig_file . content
25+ value = data. local_file . kubeconfig_file . content
2626 description = " Kubeconfig for this cluster"
2727}
Original file line number Diff line number Diff line change @@ -16,12 +16,14 @@ name = Human readable hostname for this host.
1616is_controller = Must be true for exactly one host. This will run the k3s "server". All other nodes run the k3s "agent".
1717flavour = The openstack_compute_flavor_v2 for the host
1818volume_size = Size in GB for the disk volume for the node
19+ image_uuid = (Optional) The Openstack image you want to run, to override the default in ubuntu_immage_name
1920EOT
2021 type = list (object ({
2122 name = string ,
2223 flavour = optional (string , " 2cpu4ram" ),
2324 volume_size = optional (number , 20 ),
24- is_controller = optional (bool , false )
25+ is_controller = optional (bool , false ),
26+ image_uuid = optional (string , null )
2527 }))
2628
2729 default = [
You can’t perform that action at this time.
0 commit comments