Skip to content

Commit 0e206b7

Browse files
authored
fix: added support for all region that the service supports (#440)
1 parent 27121e7 commit 0e206b7

File tree

6 files changed

+98
-26
lines changed

6 files changed

+98
-26
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ To create service credentials, access the Event Notifications service, and acces
108108
| <a name="input_kms_endpoint_url"></a> [kms\_endpoint\_url](#input\_kms\_endpoint\_url) | The URL of the KMS endpoint to use when configuring KMS encryption. The Hyper Protect Crypto Services endpoint URL format can be found at https://cloud.ibm.com/docs/hs-crypto?topic=hs-crypto-regions#new-service-endpoints, and the Key Protect endpoint URL format can be found here https://cloud.ibm.com/docs/key-protect?topic=key-protect-regions#service-endpoints. | `string` | `null` | no |
109109
| <a name="input_name"></a> [name](#input\_name) | The name of the Event Notifications instance that is created by this module. | `string` | n/a | yes |
110110
| <a name="input_plan"></a> [plan](#input\_plan) | The pricing plan of the Event Notifications instance. Possible values: `Lite`, `Standard` | `string` | `"standard"` | no |
111-
| <a name="input_region"></a> [region](#input\_region) | The IBM Cloud region where the Event Notifications resource is created. Possible values: `us-south` (Dallas), `eu-gb` (London), `eu-de` (Frankfurt), `au-syd` (Sydney), `eu-es` (Madrid) | `string` | `"us-south"` | no |
111+
| <a name="input_region"></a> [region](#input\_region) | The IBM Cloud region where the Event Notifications resource is created. Possible values: `jp-osa` (Osaka), `au-syd` (Sydney), `jp-tok` (Tokyo), `eu-de` (Frankfurt), `eu-gb` (London), `eu-es` (Madrid), `eu-fr2` (BNPP), `us-south` (Dallas), `ca-tor` (Toronto), `br-sao` (Sao Paulo) | `string` | `"us-south"` | no |
112112
| <a name="input_resource_group_id"></a> [resource\_group\_id](#input\_resource\_group\_id) | The ID of the resource group where the Event Notifications instance is created. | `string` | n/a | yes |
113113
| <a name="input_root_key_id"></a> [root\_key\_id](#input\_root\_key\_id) | The key ID of a root key, existing in the KMS instance passed in `var.existing_kms_instance_crn`, which will be used to encrypt the data encryption keys which are then used to encrypt the data. Required only if `var.kms_encryption_enabled` is set to `true`. | `string` | `null` | no |
114114
| <a name="input_service_credential_names"></a> [service\_credential\_names](#input\_service\_credential\_names) | The mapping of names and roles for service credentials that you want to create for the Event Notifications instance. | `map(string)` | `{}` | no |

ibm_catalog.json

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,19 +81,40 @@
8181
"required": true,
8282
"options": [
8383
{
84+
"displayname": "Osaka (jp-osa)",
85+
"value": "jp-osa"
86+
},
87+
{
88+
"displayname": "Sydney (au-syd)",
8489
"value": "au-syd"
8590
},
8691
{
92+
"displayname": "Tokyo (jp-tok)",
93+
"value": "jp-tok"
94+
},
95+
{
96+
"displayname": "Frankfurt (eu-de)",
8797
"value": "eu-de"
8898
},
8999
{
100+
"displayname": "London (eu-gb)",
90101
"value": "eu-gb"
91102
},
92103
{
104+
"displayname": "Madrid (eu-es)",
93105
"value": "eu-es"
94106
},
95107
{
108+
"displayname": "Dallas (us-south)",
96109
"value": "us-south"
110+
},
111+
{
112+
"displayname": "Toronto (ca-tor)",
113+
"value": "ca-tor"
114+
},
115+
{
116+
"displayname": "Sao Paulo (br-sao)",
117+
"value": "br-sao"
97118
}
98119
]
99120
},
@@ -245,19 +266,40 @@
245266
"required": true,
246267
"options": [
247268
{
269+
"displayname": "Osaka (jp-osa)",
270+
"value": "jp-osa"
271+
},
272+
{
273+
"displayname": "Sydney (au-syd)",
248274
"value": "au-syd"
249275
},
250276
{
277+
"displayname": "Tokyo (jp-tok)",
278+
"value": "jp-tok"
279+
},
280+
{
281+
"displayname": "Frankfurt (eu-de)",
251282
"value": "eu-de"
252283
},
253284
{
285+
"displayname": "London (eu-gb)",
254286
"value": "eu-gb"
255287
},
256288
{
289+
"displayname": "Madrid (eu-es)",
257290
"value": "eu-es"
258291
},
259292
{
293+
"displayname": "Dallas (us-south)",
260294
"value": "us-south"
295+
},
296+
{
297+
"displayname": "Toronto (ca-tor)",
298+
"value": "ca-tor"
299+
},
300+
{
301+
"displayname": "Sao Paulo (br-sao)",
302+
"value": "br-sao"
261303
}
262304
]
263305
},
@@ -268,9 +310,11 @@
268310
"key": "service_plan",
269311
"options": [
270312
{
313+
"displayname": "lite",
271314
"value": "lite"
272315
},
273316
{
317+
"displayname": "standard",
274318
"value": "standard"
275319
}
276320
]
@@ -279,9 +323,11 @@
279323
"key": "service_endpoints",
280324
"options": [
281325
{
326+
"displayname": "public",
282327
"value": "public"
283328
},
284329
{
330+
"displayname": "public-and-private",
285331
"value": "public-and-private"
286332
}
287333
]
@@ -311,9 +357,11 @@
311357
"key": "kms_endpoint_type",
312358
"options": [
313359
{
360+
"displayname": "public",
314361
"value": "public"
315362
},
316363
{
364+
"displayname": "private",
317365
"value": "private"
318366
}
319367
]
@@ -323,12 +371,15 @@
323371
"hidden": true,
324372
"options": [
325373
{
374+
"displayname": "private",
326375
"value": "private"
327376
},
328377
{
378+
"displayname": "public",
329379
"value": "public"
330380
},
331381
{
382+
"displayname": "public-and-private",
332383
"value": "public-and-private"
333384
}
334385
]
@@ -379,12 +430,15 @@
379430
"key": "management_endpoint_type_for_bucket",
380431
"options": [
381432
{
433+
"displayname": "private",
382434
"value": "private"
383435
},
384436
{
437+
"displayname": "public",
385438
"value": "public"
386439
},
387440
{
441+
"displayname": "direct",
388442
"value": "direct"
389443
}
390444
]
@@ -396,9 +450,11 @@
396450
"key": "existing_secrets_manager_endpoint_type",
397451
"options": [
398452
{
453+
"displayname": "private",
399454
"value": "private"
400455
},
401456
{
457+
"displayname": "public",
402458
"value": "public"
403459
}
404460
]

modules/fscloud/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ No resources.
8989
| <a name="input_existing_kms_instance_crn"></a> [existing\_kms\_instance\_crn](#input\_existing\_kms\_instance\_crn) | The CRN of the Hyper Protect Crypto Services or Key Protect instance. To ensure compliance with IBM Cloud Framework for Financial Services standards, it is required to use Hyper Protect Crypto Services only. | `string` | n/a | yes |
9090
| <a name="input_kms_endpoint_url"></a> [kms\_endpoint\_url](#input\_kms\_endpoint\_url) | The KMS endpoint URL to use when you configure KMS encryption. | `string` | n/a | yes |
9191
| <a name="input_name"></a> [name](#input\_name) | The name of the Event Notifications instance that is created by this module. | `string` | n/a | yes |
92-
| <a name="input_region"></a> [region](#input\_region) | The IBM Cloud region where the Event Notifications resource is created. Possible values: `us-south` (Dallas), `eu-gb` (London), `eu-de` (Frankfurt), `au-syd` (Sydney), `eu-es` (Madrid) | `string` | `"us-south"` | no |
92+
| <a name="input_region"></a> [region](#input\_region) | The IBM Cloud region where the Event Notifications resource is created. Possible values: `jp-osa` (Osaka), `au-syd` (Sydney), `jp-tok` (Tokyo), `eu-de` (Frankfurt), `eu-gb` (London), `eu-es` (Madrid), `eu-fr2` (BNPP), `us-south` (Dallas), `ca-tor` (Toronto), `br-sao` (Sao Paulo) | `string` | `"us-south"` | no |
9393
| <a name="input_resource_group_id"></a> [resource\_group\_id](#input\_resource\_group\_id) | The resource group ID to use when creating the Event Notifications instance. | `string` | n/a | yes |
9494
| <a name="input_root_key_id"></a> [root\_key\_id](#input\_root\_key\_id) | The key ID of a root key, existing in the KMS instance passed in `var.existing_kms_instance_crn`, which will be used to encrypt the data encryption keys which are then used to encrypt the data. | `string` | n/a | yes |
9595
| <a name="input_service_credential_names"></a> [service\_credential\_names](#input\_service\_credential\_names) | The mapping of names and roles for service credentials that you want to create for the Event Notifications instance. | `map(string)` | `{}` | no |

modules/fscloud/variables.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ variable "access_tags" {
3333

3434
variable "region" {
3535
type = string
36-
description = "The IBM Cloud region where the Event Notifications resource is created. Possible values: `us-south` (Dallas), `eu-gb` (London), `eu-de` (Frankfurt), `au-syd` (Sydney), `eu-es` (Madrid)"
36+
description = "The IBM Cloud region where the Event Notifications resource is created. Possible values: `jp-osa` (Osaka), `au-syd` (Sydney), `jp-tok` (Tokyo), `eu-de` (Frankfurt), `eu-gb` (London), `eu-es` (Madrid), `eu-fr2` (BNPP), `us-south` (Dallas), `ca-tor` (Toronto), `br-sao` (Sao Paulo)"
3737
default = "us-south"
3838
}
3939

tests/pr_test.go

Lines changed: 35 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,11 @@ const yamlLocation = "../common-dev-assets/common-go-assets/common-permanent-res
3535
// Current supported EN region
3636
var validRegions = []string{
3737
"us-south",
38-
"eu-de",
38+
// Error occurring specific to eu-de/eu-de regions, see https://github.com/IBM-Cloud/terraform-provider-ibm/issues/6221
39+
// "eu-de",
40+
// "eu-es",
3941
"eu-gb",
4042
"au-syd",
41-
"eu-es",
4243
}
4344

4445
var permanentResources map[string]interface{}
@@ -278,28 +279,42 @@ func TestFSCloudInSchematics(t *testing.T) {
278279
func TestRunSecurityEnforcedUpgradeDASolution(t *testing.T) {
279280
t.Parallel()
280281

282+
prefix := "ensecupg"
281283
var region = validRegions[rand.Intn(len(validRegions))]
282284

283-
options := testhelper.TestOptionsDefault(&testhelper.TestOptions{
284-
Testing: t,
285-
TerraformDir: secEnforcedDir,
286-
Prefix: "en-da-upg",
287-
})
288-
289-
terraformVars := map[string]interface{}{
290-
"ibmcloud_api_key": options.RequiredEnvironmentVars["TF_VAR_ibmcloud_api_key"],
291-
"existing_resource_group_name": options.Prefix,
292-
"region": region,
293-
"existing_kms_instance_crn": permanentResources["hpcs_south_crn"],
294-
"kms_endpoint_url": permanentResources["hpcs_south_public_endpoint"],
295-
}
285+
// Verify ibmcloud_api_key variable is set
286+
checkVariable := "TF_VAR_ibmcloud_api_key"
287+
val, present := os.LookupEnv(checkVariable)
288+
require.True(t, present, checkVariable+" environment variable not set")
289+
require.NotEqual(t, "", val, checkVariable+" environment variable is empty")
296290

297-
options.TerraformVars = terraformVars
298-
output, err := options.RunTestUpgrade()
299-
if !options.UpgradeTestSkipped {
300-
assert.Nil(t, err, "This should not have errored")
301-
assert.NotNil(t, output, "Expected some output")
291+
// ------------------------------------------------------------------------------------
292+
// Deploy EN DA passing in existing RG, KMS and COS instances
293+
// ------------------------------------------------------------------------------------
294+
options := testschematic.TestSchematicOptionsDefault(&testschematic.TestSchematicOptions{
295+
Testing: t,
296+
Prefix: prefix,
297+
TarIncludePatterns: []string{
298+
"*.tf",
299+
fullyConfigurableDADir + "/*.tf",
300+
secEnforcedDir + "/*.tf",
301+
},
302+
TemplateFolder: secEnforcedDir,
303+
Tags: []string{"test-schematic"},
304+
DeleteWorkspaceOnFail: false,
305+
WaitJobCompleteMinutes: 60,
306+
})
307+
options.TerraformVars = []testschematic.TestSchematicTerraformVar{
308+
{Name: "prefix", Value: options.Prefix, DataType: "string"},
309+
{Name: "ibmcloud_api_key", Value: options.RequiredEnvironmentVars["TF_VAR_ibmcloud_api_key"], DataType: "string", Secure: true},
310+
{Name: "existing_resource_group_name", Value: permanentResources["general_test_storage_cos_instance_resource_group"], DataType: "string"},
311+
{Name: "region", Value: region, DataType: "string"},
312+
{Name: "existing_kms_instance_crn", Value: permanentResources["hpcs_south_crn"], DataType: "string"},
313+
{Name: "kms_endpoint_url", Value: permanentResources["hpcs_south_public_endpoint"], DataType: "string"},
314+
{Name: "existing_cos_instance_crn", Value: permanentResources["general_test_storage_cos_instance_crn"], DataType: "string"},
302315
}
316+
err := options.RunSchematicTest()
317+
assert.NoError(t, err, "TestRunSecurityEnforcedUpgradeDASolution using existing RG, KMS and COS Failed")
303318
}
304319

305320
func TestRunExistingResourcesInstances(t *testing.T) {

variables.tf

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,14 @@ variable "access_tags" {
6161

6262
variable "region" {
6363
type = string
64-
description = "The IBM Cloud region where the Event Notifications resource is created. Possible values: `us-south` (Dallas), `eu-gb` (London), `eu-de` (Frankfurt), `au-syd` (Sydney), `eu-es` (Madrid)"
64+
description = "The IBM Cloud region where the Event Notifications resource is created. Possible values: `jp-osa` (Osaka), `au-syd` (Sydney), `jp-tok` (Tokyo), `eu-de` (Frankfurt), `eu-gb` (London), `eu-es` (Madrid), `eu-fr2` (BNPP), `us-south` (Dallas), `ca-tor` (Toronto), `br-sao` (Sao Paulo)"
6565
default = "us-south"
6666
validation {
67-
condition = contains(["us-south", "eu-gb", "eu-de", "au-syd", "eu-es", "eu-fr2"], var.region)
68-
error_message = "The specified region is not supported. The following regions are supported: `us-south` (Dallas), `eu-gb` (London), `eu-de` (Frankfurt), `au-syd` (Sydney), `eu-es` (Madrid), `eu-fr2` (BNPP)"
67+
condition = contains(["jp-osa", "au-syd", "jp-tok", "eu-de", "eu-gb", "eu-es", "eu-fr2", "us-south", "ca-tor", "br-sao"], var.region)
68+
error_message = "The specified region is not supported. The following regions are supported: `jp-osa` (Osaka), `au-syd` (Sydney), `jp-tok` (Tokyo), `eu-de` (Frankfurt), `eu-gb` (London), `eu-es` (Madrid), `eu-fr2` (BNPP), `us-south` (Dallas), `ca-tor` (Toronto), `br-sao` (Sao Paulo)."
6969
}
7070
}
71+
7172
variable "kms_endpoint_url" {
7273
description = "The URL of the KMS endpoint to use when configuring KMS encryption. The Hyper Protect Crypto Services endpoint URL format can be found at https://cloud.ibm.com/docs/hs-crypto?topic=hs-crypto-regions#new-service-endpoints, and the Key Protect endpoint URL format can be found here https://cloud.ibm.com/docs/key-protect?topic=key-protect-regions#service-endpoints."
7374
type = string

0 commit comments

Comments
 (0)