Skip to content

Commit 68e2f3b

Browse files
authored
feat: added au-syd and ca-tor support for watsonx.ai<br>- fixed a bug where watsonx assistant region was incorrectly being used for watsonx.ai region<br>- removed debug from restapi provider<br>- updated instance inputs to use service picker dropdown<br>- udated DA to use terraform 1.12.2 (#341)
1 parent 9950bd9 commit 68e2f3b

File tree

12 files changed

+215
-245
lines changed

12 files changed

+215
-245
lines changed

ibm_catalog.json

Lines changed: 36 additions & 102 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
{
2020
"label": "Banking Application",
2121
"name": "banking",
22+
"short_description": "Sample banking application",
2223
"working_directory": "solutions/banking",
2324
"iam_permissions": [
2425
{
@@ -110,6 +111,10 @@
110111
"displayname": "Toronto (ca-tor)",
111112
"value": "ca-tor"
112113
},
114+
{
115+
"displayname": "Montreal (ca-mon)",
116+
"value": "ca-mon"
117+
},
113118
{
114119
"displayname": "Washington DC (us-east)",
115120
"value": "us-east"
@@ -122,7 +127,6 @@
122127
},
123128
{
124129
"key": "toolchain_resource_group",
125-
"required": true,
126130
"custom_config": {
127131
"type": "resource_group",
128132
"grouping": "deployment",
@@ -149,71 +153,38 @@
149153
},
150154
{
151155
"key": "watson_assistant_region",
152-
"options": [
153-
{
154-
"displayname": "Sydney (au-syd)",
155-
"value": "au-syd"
156-
},
157-
{
158-
"displayname": "Tokyo (jp-tok)",
159-
"value": "jp-tok"
160-
},
161-
{
162-
"displayname": "Frankfurt (eu-de)",
163-
"value": "eu-de"
164-
},
165-
{
166-
"displayname": "London (eu-gb)",
167-
"value": "eu-gb"
168-
},
169-
{
170-
"displayname": "Dallas (us-south)",
171-
"value": "us-south"
172-
},
173-
{
174-
"displayname": "Washington DC (us-east)",
175-
"value": "us-east"
156+
"custom_config": {
157+
"type": "region",
158+
"grouping": "deployment",
159+
"original_grouping": "deployment",
160+
"config_constraints": {
161+
"filterString": "service:conversation",
162+
"showKinds": [
163+
"region"
164+
]
176165
}
177-
]
166+
}
178167
},
179168
{
180169
"key": "watson_discovery_instance_id"
181170
},
182171
{
183172
"key": "watson_discovery_region",
184-
"options": [
185-
{
186-
"displayname": "Sydney (au-syd)",
187-
"value": "au-syd"
188-
},
189-
{
190-
"displayname": "Tokyo (jp-tok)",
191-
"value": "jp-tok"
192-
},
193-
{
194-
"displayname": "Frankfurt (eu-de)",
195-
"value": "eu-de"
196-
},
197-
{
198-
"displayname": "London (eu-gb)",
199-
"value": "eu-gb"
200-
},
201-
{
202-
"displayname": "Dallas (us-south)",
203-
"value": "us-south"
204-
},
205-
{
206-
"displayname": "Washington DC (us-east)",
207-
"value": "us-east"
173+
"custom_config": {
174+
"type": "region",
175+
"grouping": "deployment",
176+
"original_grouping": "deployment",
177+
"config_constraints": {
178+
"filterString": "service:discovery",
179+
"showKinds": [
180+
"region"
181+
]
208182
}
209-
]
183+
}
210184
},
211185
{
212186
"key": "watson_machine_learning_instance_crn"
213187
},
214-
{
215-
"key": "watson_machine_learning_instance_guid"
216-
},
217188
{
218189
"key": "watson_machine_learning_instance_resource_name"
219190
},
@@ -271,52 +242,17 @@
271242
},
272243
{
273244
"key": "secrets_manager_region",
274-
"options": [
275-
{
276-
"displayname": "Osaka (jp-osa)",
277-
"value": "jp-osa"
278-
},
279-
{
280-
"displayname": "Sydney (au-syd)",
281-
"value": "au-syd"
282-
},
283-
{
284-
"displayname": "Tokyo (jp-tok)",
285-
"value": "jp-tok"
286-
},
287-
{
288-
"displayname": "Frankfurt (eu-de)",
289-
"value": "eu-de"
290-
},
291-
{
292-
"displayname": "London (eu-gb)",
293-
"value": "eu-gb"
294-
},
295-
{
296-
"displayname": "Madrid (eu-es)",
297-
"value": "eu-es"
298-
},
299-
{
300-
"displayname": "Dallas (us-south)",
301-
"value": "us-south"
302-
},
303-
{
304-
"displayname": "Montreal (ca-mon)",
305-
"value": "ca-mon"
306-
},
307-
{
308-
"displayname": "Toronto (ca-tor)",
309-
"value": "ca-tor"
310-
},
311-
{
312-
"displayname": "Washington DC (us-east)",
313-
"value": "us-east"
314-
},
315-
{
316-
"displayname": "Sao Paolo (br-sao)",
317-
"value": "br-sao"
245+
"custom_config": {
246+
"type": "region",
247+
"grouping": "deployment",
248+
"original_grouping": "deployment",
249+
"config_constraints": {
250+
"filterString": "service:secrets-manager",
251+
"showKinds": [
252+
"region"
253+
]
318254
}
319-
]
255+
}
320256
},
321257
{
322258
"key": "trigger_ci_pipeline_run"
@@ -331,10 +267,8 @@
331267
"key": "provision_public_ingress"
332268
}
333269
],
334-
"release_notes_url": "RELEASE NOTES URL",
335-
"outputs": [],
336270
"install_type": "fullstack",
337-
"terraform_version": "1.10.5",
271+
"terraform_version": "1.12.2",
338272
"ignore_readme": true
339273
}
340274
]

modules/watson-machine-learning/main.tf

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,18 @@ module "storage_delegation" {
2525
cos_guid = module.cos.cos_instance_guid
2626
}
2727

28+
# parse the crn for region and guid
29+
module "crn_parser" {
30+
source = "terraform-ibm-modules/common-utilities/ibm//modules/crn-parser"
31+
version = "1.3.3"
32+
crn = var.watson_ml_instance_crn
33+
}
34+
35+
locals {
36+
watson_ml_instance_guid = module.crn_parser.service_instance
37+
watson_ml_instance_region = module.crn_parser.region
38+
}
39+
2840
## Use code from Watson SaaS directly to avoid "legacy module" issues
2941
## Note: passing a non-null delegated storage attribute may result in API errors
3042

@@ -57,7 +69,7 @@ var.watson_ml_project_sensitive ? "\"settings\": {\"access_restrictions\": {\"d
5769
"compute": [
5870
{
5971
"name": "${var.watson_ml_instance_resource_name}",
60-
"guid": "${var.watson_ml_instance_guid}",
72+
"guid": "${local.watson_ml_instance_guid}",
6173
"type": "machine_learning",
6274
"crn": "${var.watson_ml_instance_crn}"
6375
}
@@ -75,7 +87,7 @@ update_data = <<-EOT
7587
"compute": [
7688
{
7789
"name": "${var.watson_ml_instance_resource_name}",
78-
"guid": "${var.watson_ml_instance_guid}",
90+
"guid": "${local.watson_ml_instance_guid}",
7991
"type": "machine_learning",
8092
"crn": "${var.watson_ml_instance_crn}",
8193
"credentials": { }
@@ -106,10 +118,12 @@ locals {
106118
"us-south" = "//api.dataplatform.cloud.ibm.com",
107119
"eu-gb" = "//api.eu-uk.dataplatform.cloud.ibm.com",
108120
"eu-de" = "//api.eu-de.dataplatform.cloud.ibm.com",
109-
"jp-tok" = "//api.jp-tok.dataplatform.cloud.ibm.com"
121+
"jp-tok" = "//api.jp-tok.dataplatform.cloud.ibm.com",
122+
"au-syd" = "//api.au-syd.dai.cloud.ibm.com",
123+
"ca-tor" = "//api.ca-tor.dai.cloud.ibm.com"
110124
}
111125

112-
dataplatform_api = local.dataplatform_api_mapping[var.location]
126+
dataplatform_api = local.dataplatform_api_mapping[local.watson_ml_instance_region]
113127
watsonx_project_id_object = restapi_object.configure_project.id
114128
watsonx_project_id = regex("^.+/([a-f0-9\\-]+)$", local.watsonx_project_id_object)[0]
115129
}

modules/watson-machine-learning/variables.tf

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,6 @@ variable "watson_ml_instance_crn" {
4444
type = string
4545
}
4646

47-
variable "watson_ml_instance_guid" {
48-
description = "Watson Machine Learning instance GUID"
49-
type = string
50-
}
51-
5247
variable "watson_ml_instance_resource_name" {
5348
description = "Watson Machine Learning instance resource name"
5449
type = string
@@ -77,11 +72,6 @@ variable "watson_ml_project_sensitive" {
7772
default = false
7873
}
7974

80-
variable "location" {
81-
description = "The location that's used with the IBM Cloud Terraform IBM provider. It's also used during resource creation."
82-
type = string
83-
}
84-
8575
variable "watsonx_project_delegated" {
8676
description = "Watson storage delegation."
8777
type = bool

solutions/banking/main.tf

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
locals {
22
use_watson_discovery = (var.watson_discovery_instance_id != null) ? true : false
3-
use_watson_machine_learning = (var.watson_machine_learning_instance_guid != null && var.watson_project_name != null) ? true : false
3+
use_watson_machine_learning = (var.watson_machine_learning_instance_crn != null && var.watson_project_name != null) ? true : false
44
use_elastic_index = (var.elastic_instance_crn != null) ? true : false
55

66
cos_instance_name = try("${local.prefix}-rag-sample-app-cos", "gen-ai-rag-sample-app-cos")
@@ -133,7 +133,6 @@ module "configure_wml_project" {
133133
count = local.use_watson_machine_learning ? 1 : 0
134134
source = "../../modules/watson-machine-learning"
135135
watsonx_project_delegated = var.cos_kms_crn != null ? true : false
136-
watson_ml_instance_guid = var.watson_machine_learning_instance_guid
137136
watson_ml_instance_crn = var.watson_machine_learning_instance_crn
138137
watson_ml_instance_resource_name = var.watson_machine_learning_instance_resource_name
139138
watson_ml_project_name = local.watson_ml_project_name
@@ -144,7 +143,6 @@ module "configure_wml_project" {
144143
cos_kms_key_crn = var.cos_kms_key_crn
145144
cos_kms_ring_id = var.cos_kms_ring_id
146145
cos_kms_new_key_name = local.cos_kms_new_key_name
147-
location = var.watson_assistant_region
148146
}
149147

150148
moved {

solutions/banking/provider.tf

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ provider "ibm" {
2121
provider "restapi" {
2222
uri = "https:"
2323
write_returns_object = true
24-
debug = true
2524
headers = {
2625
Authorization = data.ibm_iam_auth_token.tokendata.iam_access_token
2726
Content-Type = "application/json"
@@ -32,7 +31,6 @@ provider "restapi" {
3231
alias = "restapi_watsonx_admin"
3332
uri = "https:"
3433
write_returns_object = true
35-
debug = true
3634
headers = {
3735
Authorization = data.ibm_iam_auth_token.tokendata.iam_access_token
3836
Content-Type = "application/json"

solutions/banking/variables.tf

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -99,12 +99,6 @@ variable "watson_machine_learning_instance_crn" {
9999
default = null # WML usage is optional, elastic can be used instead
100100
}
101101

102-
variable "watson_machine_learning_instance_guid" {
103-
description = "Watson Machine Learning instance GUID"
104-
type = string
105-
default = null # WML usage is optional, elastic can be used instead
106-
}
107-
108102
variable "watson_machine_learning_instance_resource_name" {
109103
description = "Watson Machine Learning instance resource name"
110104
type = string

0 commit comments

Comments
 (0)