Skip to content

Commit 68f6880

Browse files
authored
feat: added support to pass the string 'default' for ocp_version variable which will select the current OCP default version at that time. NOTE: If no value is passed (null), the default behaviour will now select the default OCP version, where before is used to pick the latest version<br>* required ibm provider version updated to >= 1.58.1, < 2.0.0 (#256)
1 parent 1b4ec11 commit 68f6880

File tree

14 files changed

+47
-45
lines changed

14 files changed

+47
-45
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ Optionally, you need the following permissions to attach Access Management tags
153153
| Name | Version |
154154
|------|---------|
155155
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.3.0, < 1.6.0 |
156-
| <a name="requirement_ibm"></a> [ibm](#requirement\_ibm) | >= 1.56.1, < 2.0.0 |
156+
| <a name="requirement_ibm"></a> [ibm](#requirement\_ibm) | >= 1.58.1, < 2.0.0 |
157157
| <a name="requirement_kubernetes"></a> [kubernetes](#requirement\_kubernetes) | >= 2.16.1 |
158158
| <a name="requirement_null"></a> [null](#requirement\_null) | >= 3.2.1 |
159159
| <a name="requirement_time"></a> [time](#requirement\_time) | >= 0.9.1 |
@@ -198,7 +198,7 @@ Optionally, you need the following permissions to attach Access Management tags
198198
| <a name="input_ignore_worker_pool_size_changes"></a> [ignore\_worker\_pool\_size\_changes](#input\_ignore\_worker\_pool\_size\_changes) | Enable if using worker autoscaling. Stops Terraform managing worker count | `bool` | `false` | no |
199199
| <a name="input_kms_config"></a> [kms\_config](#input\_kms\_config) | Use to attach a Key Protect instance to the cluster | <pre>object({<br> crk_id = string<br> instance_id = string<br> private_endpoint = optional(bool, true) # defaults to true<br> })</pre> | `null` | no |
200200
| <a name="input_ocp_entitlement"></a> [ocp\_entitlement](#input\_ocp\_entitlement) | Value that is applied to the entitlements for OCP cluster provisioning | `string` | `"cloud_pak"` | no |
201-
| <a name="input_ocp_version"></a> [ocp\_version](#input\_ocp\_version) | The version of the OpenShift cluster that should be provisioned (format 4.x). This is only used during initial cluster provisioning, but ignored for future updates. If no value is passed, or the string 'latest' is passed, the current latest OCP version will be used. | `string` | `null` | no |
201+
| <a name="input_ocp_version"></a> [ocp\_version](#input\_ocp\_version) | The version of the OpenShift cluster that should be provisioned (format 4.x). This is only used during initial cluster provisioning, but ignored for future updates. Supports passing the string 'latest' (current latest available version) or 'default' (current IKS default recommended version). If no value is passed, it will default to 'default'. | `string` | `null` | no |
202202
| <a name="input_region"></a> [region](#input\_region) | The IBM Cloud region where the cluster will be provisioned. | `string` | n/a | yes |
203203
| <a name="input_resource_group_id"></a> [resource\_group\_id](#input\_resource\_group\_id) | The Id of an existing IBM Cloud resource group where the cluster will be grouped. | `string` | n/a | yes |
204204
| <a name="input_tags"></a> [tags](#input\_tags) | Metadata labels describing this cluster deployment, i.e. test | `list(string)` | `[]` | no |

examples/add_rules_to_sg/version.tf

Lines changed: 1 addition & 1 deletion
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.56.1"
6+
version = ">= 1.58.1"
77
}
88
}
99
}

examples/apply_taints/version.tf

Lines changed: 1 addition & 1 deletion
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.56.1"
6+
version = ">= 1.58.1"
77
}
88
}
99
}

examples/existing_cos/version.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ terraform {
44
# Pin to the lowest provider version of the range defined in the main module to ensure lowest version still works
55
ibm = {
66
source = "ibm-cloud/ibm"
7-
version = ">= 1.56.1"
7+
version = ">= 1.58.1"
88
}
99
}
1010
}

examples/fscloud/version.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ terraform {
44
# Pin to the lowest provider version of the range defined in the main module to ensure lowest version still works
55
ibm = {
66
source = "ibm-cloud/ibm"
7-
version = "1.56.1"
7+
version = "1.58.1"
88
}
99
# The logdna provider is not actually required by the module itself, just this example, so OK to use ">=" here instead of locking into a version
1010
logdna = {

examples/multiple_mzr_clusters/version.tf

Lines changed: 1 addition & 1 deletion
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.56.1"
6+
version = ">= 1.58.1"
77
}
88
# The kubernetes provider is not actually required by the module itself, just this example, so OK to use ">=" here instead of locking into a version
99
kubernetes = {

examples/single_zone_autoscale_cluster/version.tf

Lines changed: 1 addition & 1 deletion
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.56.1"
6+
version = ">= 1.58.1"
77
}
88
kubernetes = {
99
source = "hashicorp/kubernetes"

examples/standard/version.tf

Lines changed: 1 addition & 1 deletion
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.56.1"
6+
version = "1.58.1"
77
}
88
}
99
}

main.tf

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@ locals {
1010
other_pools = [for pool in var.worker_pools : pool if pool.pool_name != "default" && !var.ignore_worker_pool_size_changes]
1111
other_autoscaling_pools = [for pool in var.worker_pools : pool if pool.pool_name != "default" && var.ignore_worker_pool_size_changes]
1212

13-
latest_kube_version = "${data.ibm_container_cluster_versions.cluster_versions.valid_openshift_versions[length(data.ibm_container_cluster_versions.cluster_versions.valid_openshift_versions) - 1]}_openshift"
14-
kube_version = var.ocp_version == null || var.ocp_version == "latest" ? local.latest_kube_version : "${var.ocp_version}_openshift"
13+
latest_ocp_version = "${data.ibm_container_cluster_versions.cluster_versions.valid_openshift_versions[length(data.ibm_container_cluster_versions.cluster_versions.valid_openshift_versions) - 1]}_openshift"
14+
default_ocp_version = "${data.ibm_container_cluster_versions.cluster_versions.default_openshift_version}_openshift"
15+
ocp_version = var.ocp_version == null || var.ocp_version == "default" ? local.default_ocp_version : (var.ocp_version == "latest" ? local.latest_ocp_version : "${var.ocp_version}_openshift")
1516

1617
cos_name = var.use_existing_cos == true || (var.use_existing_cos == false && var.cos_name != null) ? var.cos_name : "${var.cluster_name}_cos"
1718
cos_location = "global"
@@ -74,7 +75,7 @@ resource "ibm_container_vpc_cluster" "cluster" {
7475
name = var.cluster_name
7576
vpc_id = var.vpc_id
7677
tags = var.tags
77-
kube_version = local.kube_version
78+
kube_version = local.ocp_version
7879
flavor = local.default_pool.machine_type
7980
entitlement = var.ocp_entitlement
8081
cos_instance_crn = local.cos_instance_crn
@@ -135,7 +136,7 @@ resource "ibm_container_vpc_cluster" "autoscaling_cluster" {
135136
name = var.cluster_name
136137
vpc_id = var.vpc_id
137138
tags = var.tags
138-
kube_version = local.kube_version
139+
kube_version = local.ocp_version
139140
flavor = local.default_pool.machine_type
140141
entitlement = var.ocp_entitlement
141142
cos_instance_crn = local.cos_instance_crn

module-metadata.json

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
],
1414
"pos": {
1515
"filename": "variables.tf",
16-
"line": 176
16+
"line": 177
1717
},
1818
"min_length": 1,
1919
"max_length": 128,
@@ -29,7 +29,7 @@
2929
"description": "List of all addons supported by the ocp cluster.",
3030
"pos": {
3131
"filename": "variables.tf",
32-
"line": 201
32+
"line": 202
3333
}
3434
},
3535
"cluster_name": {
@@ -58,7 +58,7 @@
5858
],
5959
"pos": {
6060
"filename": "variables.tf",
61-
"line": 120
61+
"line": 121
6262
}
6363
},
6464
"cos_name": {
@@ -67,7 +67,7 @@
6767
"description": "Name of the COS instance to provision. New instance only provisioned if `use_existing_cos = false`. Default: `\u003ccluster_name\u003e_cos`",
6868
"pos": {
6969
"filename": "variables.tf",
70-
"line": 148
70+
"line": 149
7171
}
7272
},
7373
"disable_public_endpoint": {
@@ -82,7 +82,7 @@
8282
],
8383
"pos": {
8484
"filename": "variables.tf",
85-
"line": 130
85+
"line": 131
8686
}
8787
},
8888
"existing_cos_id": {
@@ -91,7 +91,7 @@
9191
"description": "The COS id of an already existing COS instance. Only required if 'use_existing_cos = true'",
9292
"pos": {
9393
"filename": "variables.tf",
94-
"line": 160
94+
"line": 161
9595
}
9696
},
9797
"force_delete_storage": {
@@ -105,7 +105,7 @@
105105
],
106106
"pos": {
107107
"filename": "variables.tf",
108-
"line": 142
108+
"line": 143
109109
}
110110
},
111111
"ibmcloud_api_key": {
@@ -144,7 +144,7 @@
144144
"description": "Use to attach a Key Protect instance to the cluster",
145145
"pos": {
146146
"filename": "variables.tf",
147-
"line": 166
147+
"line": 167
148148
}
149149
},
150150
"ocp_entitlement": {
@@ -158,13 +158,13 @@
158158
],
159159
"pos": {
160160
"filename": "variables.tf",
161-
"line": 136
161+
"line": 137
162162
}
163163
},
164164
"ocp_version": {
165165
"name": "ocp_version",
166166
"type": "string",
167-
"description": "The version of the OpenShift cluster that should be provisioned (format 4.x). This is only used during initial cluster provisioning, but ignored for future updates. If no value is passed, or the string 'latest' is passed, the current latest OCP version will be used.",
167+
"description": "The version of the OpenShift cluster that should be provisioned (format 4.x). This is only used during initial cluster provisioning, but ignored for future updates. Supports passing the string 'latest' (current latest available version) or 'default' (current IKS default recommended version). If no value is passed, it will default to 'default'.",
168168
"pos": {
169169
"filename": "variables.tf",
170170
"line": 102
@@ -238,7 +238,7 @@
238238
],
239239
"pos": {
240240
"filename": "variables.tf",
241-
"line": 154
241+
"line": 155
242242
}
243243
},
244244
"verify_worker_network_readiness": {
@@ -252,7 +252,7 @@
252252
],
253253
"pos": {
254254
"filename": "variables.tf",
255-
"line": 195
255+
"line": 196
256256
}
257257
},
258258
"vpc_id": {
@@ -268,7 +268,7 @@
268268
],
269269
"pos": {
270270
"filename": "variables.tf",
271-
"line": 190
271+
"line": 191
272272
},
273273
"immutable": true
274274
},
@@ -409,7 +409,7 @@
409409
"ibm": {
410410
"source": "ibm-cloud/ibm",
411411
"version_constraints": [
412-
"\u003e= 1.56.1, \u003c 2.0.0"
412+
"\u003e= 1.58.1, \u003c 2.0.0"
413413
]
414414
},
415415
"kubernetes": {
@@ -444,7 +444,7 @@
444444
},
445445
"pos": {
446446
"filename": "main.tf",
447-
"line": 363
447+
"line": 364
448448
}
449449
},
450450
"ibm_container_vpc_cluster.autoscaling_cluster": {
@@ -467,7 +467,7 @@
467467
},
468468
"pos": {
469469
"filename": "main.tf",
470-
"line": 133
470+
"line": 134
471471
}
472472
},
473473
"ibm_container_vpc_cluster.cluster": {
@@ -490,7 +490,7 @@
490490
},
491491
"pos": {
492492
"filename": "main.tf",
493-
"line": 71
493+
"line": 72
494494
}
495495
},
496496
"ibm_container_vpc_worker_pool.autoscaling_pool": {
@@ -506,7 +506,7 @@
506506
},
507507
"pos": {
508508
"filename": "main.tf",
509-
"line": 284
509+
"line": 285
510510
}
511511
},
512512
"ibm_container_vpc_worker_pool.pool": {
@@ -522,7 +522,7 @@
522522
},
523523
"pos": {
524524
"filename": "main.tf",
525-
"line": 243
525+
"line": 244
526526
}
527527
},
528528
"ibm_resource_tag.cluster_access_tag": {
@@ -539,7 +539,7 @@
539539
},
540540
"pos": {
541541
"filename": "main.tf",
542-
"line": 197
542+
"line": 198
543543
}
544544
},
545545
"ibm_resource_tag.cos_access_tag": {
@@ -555,7 +555,7 @@
555555
},
556556
"pos": {
557557
"filename": "main.tf",
558-
"line": 60
558+
"line": 61
559559
}
560560
},
561561
"kubernetes_config_map_v1_data.set_autoscaling": {
@@ -570,7 +570,7 @@
570570
},
571571
"pos": {
572572
"filename": "main.tf",
573-
"line": 404
573+
"line": 405
574574
}
575575
},
576576
"null_resource.confirm_network_healthy": {
@@ -585,7 +585,7 @@
585585
},
586586
"pos": {
587587
"filename": "main.tf",
588-
"line": 344
588+
"line": 345
589589
}
590590
},
591591
"null_resource.reset_api_key": {
@@ -597,7 +597,7 @@
597597
},
598598
"pos": {
599599
"filename": "main.tf",
600-
"line": 218
600+
"line": 219
601601
}
602602
},
603603
"time_sleep.wait_operators": {
@@ -609,7 +609,7 @@
609609
},
610610
"pos": {
611611
"filename": "main.tf",
612-
"line": 386
612+
"line": 387
613613
}
614614
}
615615
},
@@ -627,7 +627,7 @@
627627
},
628628
"pos": {
629629
"filename": "main.tf",
630-
"line": 232
630+
"line": 233
631631
}
632632
},
633633
"data.ibm_container_cluster_versions.cluster_versions": {
@@ -642,7 +642,7 @@
642642
},
643643
"pos": {
644644
"filename": "main.tf",
645-
"line": 38
645+
"line": 39
646646
}
647647
}
648648
},
@@ -904,7 +904,7 @@
904904
},
905905
"pos": {
906906
"filename": "main.tf",
907-
"line": 42
907+
"line": 43
908908
}
909909
}
910910
}

0 commit comments

Comments
 (0)