Skip to content

Commit 980cfc7

Browse files
nupurg-ibmNupur Goyal
and
Nupur Goyal
authored
fix: Fix for vni resource group placement issue and custom image builder bug (#220)
BREAKING CHANGE: Fix VNI resource group placement bug<br>* Fix custom image builder bug<br>* Updating module and provider versions --------- Co-authored-by: Nupur Goyal <nupurgoyal@Nupurs-MacBook-Pro.local>
1 parent e042353 commit 980cfc7

32 files changed

+699
-296
lines changed

ibm_catalog.json

+12-3
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,18 @@
372372
"key": "worker_node_max_count"
373373
},
374374
{
375-
"key": "worker_node_instance_type"
375+
"key": "worker_node_instance_type",
376+
"type": "array",
377+
"default_value": "[\n {\n \"count\": 0,\n \"instance_type\": \"bx2-4x16\"\n },\n {\n \"count\": 0,\n \"instance_type\": \"cx2-8x16\"\n }\n]",
378+
"required": false,
379+
"custom_config": {
380+
"type": "json_editor",
381+
"grouping": "deployment",
382+
"original_grouping": "deployment",
383+
"config_constraints": {
384+
"type": "mixed"
385+
}
386+
}
376387
},
377388
{
378389
"key": "enable_dedicated_host"
@@ -396,7 +407,6 @@
396407
"key": "custom_file_shares",
397408
"type": "array",
398409
"default_value": "[\n {\n \"mount_path\": \"/mnt/vpcstorage/tools\",\n \"size\": 100,\n \"iops\": 2000\n },\n {\n \"mount_path\": \"/mnt/vpcstorage/data\",\n \"size\": 100,\n \"iops\": 6000\n },\n {\n \"mount_path\": \"/mnt/scale/tools\",\n \"nfs_share\": \"\"\n }\n]\n",
399-
"display_name": "JSON",
400410
"required": false,
401411
"custom_config": {
402412
"type": "json_editor",
@@ -485,7 +495,6 @@
485495
{
486496
"key": "existing_bastion_ssh_private_key",
487497
"type": "multiline_secure_value",
488-
"display_name": "Multiline secure value",
489498
"required": false,
490499
"custom_config": {
491500
"grouping": "deployment",

modules/bootstrap/datasource.tf

-5
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,6 @@ data "ibm_is_image" "bastion" {
22
name = local.bastion_image_name
33
}
44

5-
data "ibm_is_ssh_key" "bastion" {
6-
for_each = toset(var.ssh_keys)
7-
name = each.key
8-
}
9-
105
# Existing Bastion details
116
data "ibm_is_instance" "bastion_instance_name" {
127
count = var.bastion_instance_name != null ? 1 : 0

modules/bootstrap/locals.tf

-2
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@ locals {
3030

3131
bastion_image_id = data.ibm_is_image.bastion.id
3232

33-
bastion_ssh_keys = [for name in var.ssh_keys : data.ibm_is_ssh_key.bastion[name].id]
34-
3533
bastion_sg_variable_cidr_list = var.network_cidr
3634
# Security group rules
3735
# TODO: Fix SG rules

modules/bootstrap/main.tf

+2-2
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ module "existing_bastion_sg_update" {
4545
module "bastion_vsi" {
4646
count = var.bastion_instance_name != null ? 0 : 1
4747
source = "terraform-ibm-modules/landing-zone-vsi/ibm"
48-
version = "4.5.0"
48+
version = "5.0.0"
4949
vsi_per_subnet = 1
5050
create_security_group = false
5151
security_group = null
@@ -55,7 +55,7 @@ module "bastion_vsi" {
5555
resource_group_id = var.resource_group
5656
enable_floating_ip = true
5757
security_group_ids = module.bastion_sg[*].security_group_id
58-
ssh_key_ids = local.bastion_ssh_keys
58+
ssh_key_ids = var.ssh_keys
5959
subnets = length(var.bastion_subnets) == 2 ? [local.bastion_subnets[1]] : [local.bastion_subnets[0]]
6060
tags = local.tags
6161
user_data = data.template_file.bastion_user_data.rendered

modules/landing_zone/main.tf

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
module "landing_zone" {
22
count = var.enable_landing_zone ? 1 : 0
33
source = "terraform-ibm-modules/landing-zone/ibm"
4-
version = "6.6.3"
4+
version = "7.4.3"
55
prefix = local.prefix
66
region = local.region
77
tags = local.tags

modules/landing_zone_vsi/datasource.tf

-10
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,6 @@ data "ibm_is_image" "login" {
1313
count = local.login_image_mapping_entry_found ? 0 : 1
1414
}
1515

16-
data "ibm_is_ssh_key" "compute" {
17-
for_each = toset(var.compute_ssh_keys)
18-
name = each.key
19-
}
20-
2116
data "ibm_is_region" "region" {
2217
name = local.region
2318
}
@@ -30,11 +25,6 @@ data "ibm_is_instance_profile" "worker_node" {
3025
name = var.worker_node_instance_type[0].instance_type
3126
}
3227

33-
data "ibm_is_ssh_key" "bastion" {
34-
for_each = toset(var.ssh_keys)
35-
name = each.key
36-
}
37-
3828
data "ibm_is_image" "ldap_vsi_image" {
3929
name = var.ldap_vsi_osimage_name
4030
count = var.ldap_basedns != null && var.ldap_server == "null" ? 1 : 0

modules/landing_zone_vsi/locals.tf

-3
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ locals {
1212
login_node_name = format("%s-%s", local.prefix, "login")
1313
management_node_name = format("%s-%s", local.prefix, "mgmt")
1414
worker_node_name = format("%s-%s", local.prefix, "worker")
15-
compute_ssh_keys = [for name in var.compute_ssh_keys : data.ibm_is_ssh_key.compute[name].id]
16-
management_ssh_keys = local.compute_ssh_keys
1715
ldap_enable = var.enable_ldap == true && var.ldap_server == "null" ? 1 : 0
1816
# enable_worker_vsi = var.solution == "lsf" && var.worker_node_min_count >= 0 ? var.worker_node_min_count : 0
1917
# products = var.solution == "lsf" && var.enable_app_center ? "lsf,lsf-app-center" : "lsf"
@@ -141,7 +139,6 @@ locals {
141139
rc_profile = data.ibm_is_instance_profile.worker_node.name
142140

143141
bastion_subnets = var.bastion_subnets
144-
bastion_ssh_keys = [for name in var.ssh_keys : data.ibm_is_ssh_key.bastion[name].id]
145142
ldap_server = var.enable_ldap == true && var.ldap_server == "null" ? length(module.ldap_vsi) > 0 ? var.ldap_primary_ip[0] : null : var.ldap_server
146143
ldap_server_cert = var.enable_ldap == true && var.ldap_server_cert != "null" ? var.ldap_server_cert : "null"
147144
ldap_instance_image_id = var.enable_ldap == true && var.ldap_server == "null" ? data.ibm_is_image.ldap_vsi_image[0].id : "null"

modules/landing_zone_vsi/main.tf

+10-10
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ module "nfs_storage_sg" {
5757
module "management_vsi" {
5858
count = 1
5959
source = "terraform-ibm-modules/landing-zone-vsi/ibm"
60-
version = "4.5.0"
60+
version = "5.0.0"
6161
vsi_per_subnet = 1
6262
create_security_group = false
6363
security_group = null
@@ -67,7 +67,7 @@ module "management_vsi" {
6767
resource_group_id = var.resource_group
6868
enable_floating_ip = false
6969
security_group_ids = module.compute_sg[*].security_group_id
70-
ssh_key_ids = local.management_ssh_keys
70+
ssh_key_ids = var.compute_ssh_keys
7171
subnets = [local.compute_subnets[0]]
7272
tags = local.tags
7373
user_data = "${data.template_file.management_user_data.rendered} ${file("${path.module}/templates/lsf_management.sh")}"
@@ -80,12 +80,12 @@ module "management_vsi" {
8080
module "management_candidate_vsi" {
8181
count = var.management_node_count - 1
8282
source = "terraform-ibm-modules/landing-zone-vsi/ibm"
83-
version = "4.5.0"
83+
version = "5.0.0"
8484
create_security_group = false
8585
security_group = null
8686
security_group_ids = module.compute_sg[*].security_group_id
8787
vpc_id = var.vpc_id
88-
ssh_key_ids = local.management_ssh_keys
88+
ssh_key_ids = var.compute_ssh_keys
8989
subnets = [local.compute_subnets[0]]
9090
resource_group_id = var.resource_group
9191
enable_floating_ip = false
@@ -103,7 +103,7 @@ module "management_candidate_vsi" {
103103
module "worker_vsi" {
104104
count = length(local.flattened_worker_nodes)
105105
source = "terraform-ibm-modules/landing-zone-vsi/ibm"
106-
version = "4.5.0"
106+
version = "5.0.0"
107107
vsi_per_subnet = 1
108108
create_security_group = false
109109
security_group = null
@@ -113,7 +113,7 @@ module "worker_vsi" {
113113
resource_group_id = var.resource_group
114114
enable_floating_ip = false
115115
security_group_ids = module.compute_sg[*].security_group_id
116-
ssh_key_ids = local.management_ssh_keys
116+
ssh_key_ids = var.compute_ssh_keys
117117
subnets = [local.compute_subnets[0]]
118118
tags = local.tags
119119
user_data = "${data.template_file.worker_user_data.rendered} ${file("${path.module}/templates/static_worker_vsi.sh")}"
@@ -129,7 +129,7 @@ module "worker_vsi" {
129129
module "login_vsi" {
130130
# count = 1
131131
source = "terraform-ibm-modules/landing-zone-vsi/ibm"
132-
version = "4.5.0"
132+
version = "5.0.0"
133133
vsi_per_subnet = 1
134134
create_security_group = false
135135
security_group = null
@@ -139,7 +139,7 @@ module "login_vsi" {
139139
resource_group_id = var.resource_group
140140
enable_floating_ip = false
141141
security_group_ids = [var.bastion_security_group_id]
142-
ssh_key_ids = local.bastion_ssh_keys
142+
ssh_key_ids = var.bastion_ssh_keys
143143
subnets = length(var.bastion_subnets) == 2 ? [local.bastion_subnets[1]] : [local.bastion_subnets[0]]
144144
tags = local.tags
145145
user_data = "${data.template_file.login_user_data.rendered} ${file("${path.module}/templates/login_vsi.sh")}"
@@ -153,7 +153,7 @@ module "login_vsi" {
153153
module "ldap_vsi" {
154154
count = local.ldap_enable
155155
source = "terraform-ibm-modules/landing-zone-vsi/ibm"
156-
version = "4.5.0"
156+
version = "5.0.0"
157157
vsi_per_subnet = 1
158158
create_security_group = false
159159
security_group = null
@@ -163,7 +163,7 @@ module "ldap_vsi" {
163163
resource_group_id = var.resource_group
164164
enable_floating_ip = false
165165
security_group_ids = module.compute_sg[*].security_group_id
166-
ssh_key_ids = local.management_ssh_keys
166+
ssh_key_ids = var.compute_ssh_keys
167167
subnets = [local.compute_subnets[0]]
168168
tags = local.tags
169169
user_data = var.enable_ldap == true && var.ldap_server == "null" ? "${data.template_file.ldap_user_data[0].rendered} ${file("${path.module}/templates/ldap_user_data.sh")}" : ""

modules/landing_zone_vsi/template_files.tf

+1-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ data "template_file" "management_values" {
9494
image_id = local.compute_image_from_data ? data.ibm_is_image.compute[0].id : local.new_compute_image_id
9595
subnet_id = local.compute_subnets[0].crn
9696
security_group_id = module.compute_sg[0].security_group_id
97-
sshkey_id = join(",", local.compute_ssh_keys)
97+
sshkey_id = join(",", var.compute_ssh_keys)
9898
region_name = data.ibm_is_region.region.name
9999
zone_name = var.zones[0]
100100
vpc_id = var.vpc_id

modules/landing_zone_vsi/variables.tf

+1-1
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ variable "bastion_subnets" {
261261
description = "Subnets to launch the bastion host."
262262
}
263263

264-
variable "ssh_keys" {
264+
variable "bastion_ssh_keys" {
265265
type = list(string)
266266
description = "The key pair to use to access the host."
267267
}

solutions/hpc/datasource.tf

+10
Original file line numberDiff line numberDiff line change
@@ -84,3 +84,13 @@ resource "ibm_is_subnet_public_gateway_attachment" "zone_1_attachment" {
8484
data "ibm_is_dedicated_host_profiles" "worker" {
8585
count = var.enable_dedicated_host ? 1 : 0
8686
}
87+
88+
data "ibm_is_ssh_key" "bastion" {
89+
for_each = toset(var.bastion_ssh_keys)
90+
name = each.key
91+
}
92+
93+
data "ibm_is_ssh_key" "compute" {
94+
for_each = toset(var.compute_ssh_keys)
95+
name = each.key
96+
}

solutions/hpc/locals.tf

+2-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,8 @@ locals {
7070

7171
# locals needed for file-storage
7272
locals {
73-
73+
compute_ssh_keys = [for name in var.compute_ssh_keys : data.ibm_is_ssh_key.compute[name].id]
74+
bastion_ssh_keys = [for name in var.bastion_ssh_keys : data.ibm_is_ssh_key.bastion[name].id]
7475
# dependency: landing_zone_vsi -> file-share
7576
compute_subnet_id = local.compute_subnets[0].id
7677
compute_security_group_id = module.landing_zone_vsi[0].compute_sg_id

solutions/hpc/main.tf

+3-3
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ module "bootstrap" {
3434
vpc_id = local.vpc_id
3535
network_cidr = var.vpc_name != null && length(var.cluster_subnet_ids) > 0 ? local.existing_subnet_cidrs : split(",", var.vpc_cidr)
3636
bastion_subnets = local.bastion_subnets
37-
ssh_keys = var.bastion_ssh_keys
37+
ssh_keys = local.bastion_ssh_keys
3838
allowed_cidr = local.allowed_cidr
3939
kms_encryption_enabled = local.kms_encryption_enabled
4040
boot_volume_encryption_key = local.boot_volume_encryption_key
@@ -95,7 +95,7 @@ module "landing_zone_vsi" {
9595
compute_private_key_content = local.compute_private_key_content
9696
bastion_private_key_content = local.bastion_ssh_private_key != null ? local.bastion_ssh_private_key : local.bastion_private_key_content
9797
compute_subnets = local.compute_subnets
98-
compute_ssh_keys = var.compute_ssh_keys
98+
compute_ssh_keys = local.compute_ssh_keys
9999
management_image_name = var.management_image_name
100100
compute_image_name = var.compute_image_name
101101
login_image_name = var.login_image_name
@@ -114,7 +114,7 @@ module "landing_zone_vsi" {
114114
mount_path = var.custom_file_shares
115115
login_node_instance_type = var.login_node_instance_type
116116
bastion_subnets = local.bastion_subnets
117-
ssh_keys = var.bastion_ssh_keys
117+
bastion_ssh_keys = local.bastion_ssh_keys
118118
enable_ldap = var.enable_ldap
119119
ldap_basedns = var.ldap_basedns
120120
login_private_ips = join("", local.login_private_ips)

solutions/hpc/version.tf

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ terraform {
33
required_providers {
44
ibm = {
55
source = "IBM-Cloud/ibm"
6-
version = "1.71.3"
6+
version = "1.77.0"
77
}
88
null = {
99
source = "hashicorp/null"

0 commit comments

Comments
 (0)