Skip to content

Commit b6fc114

Browse files
authored
fix: expose cluster entitlement variable for OCP quickstart DA solution (#756)
1 parent 746ba4a commit b6fc114

File tree

3 files changed

+20
-5
lines changed

3 files changed

+20
-5
lines changed

patterns/roks-quickstart/main.tf

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
locals {
66
default_ocp_version = "${data.ibm_container_cluster_versions.cluster_versions.default_openshift_version}_openshift"
77
ocp_version = var.kube_version == null || var.kube_version == "default" ? local.default_ocp_version : "${var.kube_version}_openshift"
8+
entitlement_val = var.entitlement == null ? "null" : "\"${var.entitlement}\""
89
}
910

1011
data "ibm_container_cluster_versions" "cluster_versions" {
@@ -48,7 +49,7 @@ locals {
4849
"vpc_name": "workload",
4950
"worker_pools": [],
5051
"workers_per_subnet": 1,
51-
"entitlement": "cloud_pak",
52+
"entitlement": ${local.entitlement_val},
5253
"disable_public_endpoint": false
5354
}
5455
],

patterns/roks-quickstart/variables.tf

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ variable "ibmcloud_api_key" {
1111
variable "prefix" {
1212
description = "A unique identifier for resources. Must begin with a lowercase letter and end with a lowercase letter or number. This prefix will be prepended to any resources provisioned by this template. Prefixes must be 13 or fewer characters."
1313
type = string
14-
default = "land-zone-roks-qs"
14+
default = "lz-roks-qs"
1515

1616
validation {
1717
error_message = "Prefix must begin with a letter and contain only lowercase letters, numbers, and - characters. Prefixes must end with a lowercase letter or number and be 13 or fewer characters."
@@ -42,3 +42,9 @@ variable "flavor" {
4242
type = string
4343
default = "bx2.4x16"
4444
}
45+
46+
variable "entitlement" {
47+
description = "If you do not have an entitlement, leave as null. Entitlement reduces additional OCP Licence cost in OpenShift clusters. Use Cloud Pak with OCP Licence entitlement to create the OpenShift cluster. Note It is set only when the first time creation of the cluster, further modifications are not impacted Set this argument to cloud_pak only if you use the cluster with a Cloud Pak that has an OpenShift entitlement."
48+
type = string
49+
default = null
50+
}

tests/pr_test.go

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,9 @@ func setupOptionsROKSQuickStartPattern(t *testing.T, prefix string, dir string)
157157
TerraformDir: dir,
158158
Prefix: prefix,
159159
CloudInfoService: sharedInfoSvc,
160+
TerraformVars: map[string]interface{}{
161+
"entitlement": "cloud_pak",
162+
},
160163
})
161164

162165
return options
@@ -201,9 +204,11 @@ func setupOptionsRoksPattern(t *testing.T, prefix string) *testhelper.TestOption
201204
})
202205

203206
options.TerraformVars = map[string]interface{}{
204-
"prefix": options.Prefix,
205-
"tags": options.Tags,
206-
"region": options.Region,
207+
"prefix": options.Prefix,
208+
"tags": options.Tags,
209+
"region": options.Region,
210+
"entitlement": "cloud_pak",
211+
"flavor": "bx2.4x16",
207212
}
208213

209214
return options
@@ -544,6 +549,7 @@ func TestRunROKSQuickStartPatternSchematics(t *testing.T) {
544549
{Name: "ibmcloud_api_key", Value: options.RequiredEnvironmentVars["TF_VAR_ibmcloud_api_key"], DataType: "string", Secure: true},
545550
{Name: "region", Value: options.Region, DataType: "string"},
546551
{Name: "prefix", Value: options.Prefix, DataType: "string"},
552+
{Name: "entitlement", Value: "cloud_pak", DataType: "string"},
547553
}
548554

549555
err := options.RunSchematicTest()
@@ -585,6 +591,8 @@ func TestRunRoksPatternSchematics(t *testing.T) {
585591
{Name: "region", Value: options.Region, DataType: "string"},
586592
{Name: "prefix", Value: options.Prefix, DataType: "string"},
587593
{Name: "tags", Value: options.Tags, DataType: "list(string)"},
594+
{Name: "entitlement", Value: "cloud_pak", DataType: "string"},
595+
{Name: "flavor", Value: "bx2.4x16", DataType: "string"},
588596
}
589597

590598
err := options.RunSchematicTest()

0 commit comments

Comments
 (0)