Skip to content

Commit 3bca7c9

Browse files
Jordan-Williams2Jordan-Williams2
authored andcommitted
fix: bug with rg
1 parent cdedc1e commit 3bca7c9

File tree

5 files changed

+40
-14
lines changed

5 files changed

+40
-14
lines changed

solutions/fully-configurable/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -146,14 +146,14 @@ You need the following permissions to run this module:
146146
| <a name="input_cpd_admin_password"></a> [cpd\_admin\_password](#input\_cpd\_admin\_password) | Password for the Cloud Pak for Data admin user. | `string` | `"passw0rd"` | no |
147147
| <a name="input_cpd_entitlement_key"></a> [cpd\_entitlement\_key](#input\_cpd\_entitlement\_key) | Cloud Pak for Data entitlement key for access to the IBM Entitled Registry. Can be fetched from https://myibm.ibm.com/products-services/containerlibrary. | `string` | n/a | yes |
148148
| <a name="input_cpd_version"></a> [cpd\_version](#input\_cpd\_version) | Cloud Pak for Data version to install. Only version 5.x.x is supported, latest versions can be found [here](https://www.ibm.com/docs/en/cloud-paks/cp-data?topic=versions-cloud-pak-data). | `string` | `"5.0.3"` | no |
149-
| <a name="input_existing_cluster_name"></a> [existing\_cluster\_name](#input\_existing\_cluster\_name) | Name of an existing Red Hat OpenShift cluster to create and install watsonx onto. | `string` | `null` | no |
150-
| <a name="input_existing_resource_group_name"></a> [existing\_resource\_group\_name](#input\_existing\_resource\_group\_name) | Resource group id of the cluster | `string` | `"Default"` | no |
149+
| <a name="input_existing_cluster_name"></a> [existing\_cluster\_name](#input\_existing\_cluster\_name) | Name of an existing Red Hat OpenShift cluster to create and install watsonx onto. | `string` | n/a | yes |
150+
| <a name="input_existing_resource_group_name"></a> [existing\_resource\_group\_name](#input\_existing\_resource\_group\_name) | Resource group id of the cluster | `string` | n/a | yes |
151151
| <a name="input_ibmcloud_api_key"></a> [ibmcloud\_api\_key](#input\_ibmcloud\_api\_key) | The IBM Cloud API key to deploy resources. | `string` | n/a | yes |
152152
| <a name="input_install_odf_cluster_addon"></a> [install\_odf\_cluster\_addon](#input\_install\_odf\_cluster\_addon) | Install the ODF cluster addon. | `bool` | `true` | no |
153153
| <a name="input_odf_config"></a> [odf\_config](#input\_odf\_config) | Configuration for the ODF addon. Example add on options can be found [here](https://cloud.ibm.com/docs/openshift?topic=openshift-deploy-odf-classic&interface=cli#install-odf-cli-classic) | `map(string)` | <pre>{<br/> "addSingleReplicaPool": "false",<br/> "billingType": "essentials",<br/> "clusterEncryption": "false",<br/> "disableNoobaaLB": "false",<br/> "enableNFS": "false",<br/> "encryptionInTransit": "false",<br/> "hpcsBaseUrl": "",<br/> "hpcsEncryption": "false",<br/> "hpcsInstanceId": "",<br/> "hpcsSecretName": "",<br/> "hpcsServiceName": "",<br/> "hpcsTokenUrl": "",<br/> "ignoreNoobaa": "true",<br/> "numOfOsd": "1",<br/> "ocsUpgrade": "false",<br/> "odfDeploy": "true",<br/> "osdDevicePaths": "",<br/> "osdSize": "512Gi",<br/> "osdStorageClassName": "ibmc-vpc-block-metro-10iops-tier",<br/> "prepareForDisasterRecovery": "false",<br/> "resourceProfile": "balanced",<br/> "taintNodes": "false",<br/> "useCephRBDAsDefaultStorageClass": "false",<br/> "workerNodes": "all",<br/> "workerPool": ""<br/>}</pre> | no |
154154
| <a name="input_odf_version"></a> [odf\_version](#input\_odf\_version) | Version of ODF to install. | `string` | `"4.16.0"` | no |
155-
| <a name="input_prefix"></a> [prefix](#input\_prefix) | A unique identifier for resources that is prepended to resources that are provisioned. Must begin with a lowercase letter and end with a lowercase letter or number. Must be 16 or fewer characters. | `string` | `null` | no |
156-
| <a name="input_region"></a> [region](#input\_region) | Region where resources will be created. To find your VPC region, use `ibmcloud is regions` command to find available regions. | `string` | n/a | yes |
155+
| <a name="input_prefix"></a> [prefix](#input\_prefix) | A unique identifier for resources that is prepended to resources that are provisioned. Must begin with a lowercase letter and end with a lowercase letter or number. Must be 16 or fewer characters. | `string` | `"cp4d"` | no |
156+
| <a name="input_region"></a> [region](#input\_region) | Region where resources will be created. To find your VPC region, use `ibmcloud is regions` command to find available regions. | `string` | `"us-south"` | no |
157157
| <a name="input_watson_assistant_install"></a> [watson\_assistant\_install](#input\_watson\_assistant\_install) | If watsonx.ai is being installed, also install watson assistant | `bool` | `false` | no |
158158
| <a name="input_watson_discovery_install"></a> [watson\_discovery\_install](#input\_watson\_discovery\_install) | If watsonx.ai is being installed, also install watson discovery | `bool` | `false` | no |
159159
| <a name="input_watsonx_ai_install"></a> [watsonx\_ai\_install](#input\_watsonx\_ai\_install) | Determine whether the watsonx.ai cartridge for the deployer will be installed | `bool` | `false` | no |
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
apiVersion: v1
2+
clusters:
3+
- cluster:
4+
server: https://c100-e.us-south.containers.cloud.ibm.com:31046
5+
name: ocp-cd17-cluster/d15a61sd0urb50g6kc6g
6+
- cluster:
7+
server: https://c100-e.us-south.containers.cloud.ibm.com:31046
8+
name: c100-e-us-south-containers-cloud-ibm-com:31046
9+
contexts:
10+
- context:
11+
cluster: ocp-cd17-cluster/d15a61sd0urb50g6kc6g
12+
namespace: default
13+
user: ""
14+
name: ocp-cd17-cluster/d15a61sd0urb50g6kc6g
15+
- context:
16+
cluster: c100-e-us-south-containers-cloud-ibm-com:31046
17+
namespace: default
18+
user: IAM#[email protected]/c100-e-us-south-containers-cloud-ibm-com:31046
19+
name: default/c100-e-us-south-containers-cloud-ibm-com:31046/IAM#[email protected]
20+
current-context: default/c100-e-us-south-containers-cloud-ibm-com:31046/IAM#[email protected]
21+
kind: Config
22+
preferences: {}
23+
users:
24+
- name: IAM#[email protected]/c100-e-us-south-containers-cloud-ibm-com:31046
25+
user:
26+
token: sha256~veHYv4TSI-NGn4RC2uMj6F425fGTXusMbAZdzl6oZCE

solutions/fully-configurable/main.tf

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@ module "resource_group" {
88
existing_resource_group_name = var.existing_resource_group_name
99
}
1010

11-
locals {
12-
existing_resource_group_name = var.existing_resource_group_name != null ? var.existing_resource_group_name : module.resource_group[0].resource_group_id
13-
}
1411

1512
########################################################################################################################
1613
# Watsonx Self Managed OCP module
@@ -28,7 +25,7 @@ module "watsonx_self_managed_ocp" {
2825
cloud_pak_deployer_release = var.cloud_pak_deployer_release
2926
cloud_pak_deployer_secret = var.cloud_pak_deployer_secret
3027
cluster_name = var.existing_cluster_name
31-
cluster_rg_id = local.existing_resource_group_name
28+
cluster_rg_id = module.resource_group.resource_group_id
3229
install_odf_cluster_addon = var.install_odf_cluster_addon
3330
odf_version = var.odf_version
3431
odf_config = var.odf_config

solutions/fully-configurable/variables.tf

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ variable "ibmcloud_api_key" {
77
variable "prefix" {
88
description = "A unique identifier for resources that is prepended to resources that are provisioned. Must begin with a lowercase letter and end with a lowercase letter or number. Must be 16 or fewer characters."
99
type = string
10-
default = null
10+
default = "cp4d"
1111
validation {
1212
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 16 or fewer characters."
1313
condition = can(regex("^([a-z]|[a-z][-a-z0-9]*[a-z0-9])$", var.prefix)) && length(var.prefix) <= 16
@@ -18,6 +18,7 @@ variable "region" {
1818
description = "Region where resources will be created. To find your VPC region, use `ibmcloud is regions` command to find available regions."
1919
type = string
2020
nullable = false
21+
default = "us-south"
2122
}
2223

2324
variable "code_engine_project_name" {
@@ -58,13 +59,11 @@ variable "cloud_pak_deployer_secret" {
5859
variable "existing_cluster_name" {
5960
description = "Name of an existing Red Hat OpenShift cluster to create and install watsonx onto."
6061
type = string
61-
default = null
6262
}
6363

6464
variable "existing_resource_group_name" {
6565
description = "Resource group id of the cluster"
6666
type = string
67-
default = "Default"
6867
validation {
6968
error_message = "`existing_resource_group_name` cannot be null if `existing_cluster_name` is not null."
7069
condition = var.existing_cluster_name == null || var.existing_resource_group_name != null

tests/scripts/pre-validation-deploy-ocp-instances.sh

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ TF_VARS_FILE="terraform.tfvars"
2727
terraform apply -input=false -auto-approve -var-file=${TF_VARS_FILE} || exit 1
2828

2929
region_var_name="region"
30+
prefix_var_name="prefix"
31+
prefix_value="ocp-$(openssl rand -hex 2)"
3032
cpd_entitlement_key_var_name="cpd_entitlement_key"
3133
cpd_entitlement_key_value="${SOFTWARE_ENTITLEMENT_KEY}"
3234
existing_cluster_name_var_name="existing_cluster_name"
@@ -39,13 +41,15 @@ TF_VARS_FILE="terraform.tfvars"
3941
cd "${cwd}"
4042
jq -r --arg region_var_name "${region_var_name}" \
4143
--arg region_var_value "${REGION}" \
42-
--arg cpd_entitlement_key_var_name "${existing_cluster_name_var_name}" \
43-
--arg cpd_entitlement_key_value "${existing_cluster_name_value}" \
44+
--arg prefix_var_name "${prefix_var_name}" \
45+
--arg prefix_value "${prefix_value}" \
46+
--arg cpd_entitlement_key_var_name "${cpd_entitlement_key_var_name}" \
47+
--arg cpd_entitlement_key_value "${cpd_entitlement_key_value}" \
4448
--arg existing_cluster_name_var_name "${existing_cluster_name_var_name}" \
4549
--arg existing_cluster_name_value "${existing_cluster_name_value}" \
4650
--arg existing_resource_group_name_var_name "${existing_resource_group_name_var_name}" \
4751
--arg existing_resource_group_name_value "${existing_resource_group_name_value}" \
48-
'. + {($region_var_name): $region_var_value, ($cpd_entitlement_key_var_name): $cpd_entitlement_key_value, ($existing_cluster_name_var_name): $existing_cluster_name_value, ($existing_resource_group_name_var_name): $existing_resource_group_name_value}' "${JSON_FILE}" > tmpfile && mv tmpfile "${JSON_FILE}" || exit 1
52+
'. + {($region_var_name): $region_var_value, ($prefix_var_name): $prefix_value, ($cpd_entitlement_key_var_name): $cpd_entitlement_key_value, ($existing_cluster_name_var_name): $existing_cluster_name_value, ($existing_resource_group_name_var_name): $existing_resource_group_name_value}' "${JSON_FILE}" > tmpfile && mv tmpfile "${JSON_FILE}" || exit 1
4953

5054
echo "Pre-validation complete successfully"
5155
)

0 commit comments

Comments
 (0)