Skip to content

Commit a77b293

Browse files
feat: updated list of supported services (#308)
1 parent 88e34d6 commit a77b293

File tree

6 files changed

+86
-28
lines changed

6 files changed

+86
-28
lines changed

examples/default/main.tf

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ module "vpe_security_group" {
5959
vpc_id = var.vpc_id != null ? var.vpc_id : module.vpc[0].vpc_id
6060
}
6161

62-
6362
##############################################################################
6463
# Create a PostgreSQL instance to demonstrate how to create an instance VPE
6564
##############################################################################

examples/default/variables.tf

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -63,24 +63,10 @@ variable "security_group_ids" {
6363
default = null
6464
}
6565

66-
6766
variable "cloud_services" {
6867
description = "List of cloud services to create an endpoint gateway."
6968
type = list(string)
7069
default = ["kms", "cloud-object-storage"]
71-
72-
validation {
73-
error_message = "Currently the only supported services are Key Protect (`kms`), Cloud Object Storage (`cloud-object-storage`), Container Registry (`container-registry`), and Hyper Protect Crypto Services (`hs-crypto`). Any other VPE services must be added using `cloud_service_by_crn`."
74-
condition = length(var.cloud_services) == 0 ? true : length([
75-
for service in var.cloud_services :
76-
service if !contains([
77-
"kms",
78-
"hs-crypto",
79-
"cloud-object-storage",
80-
"container-registry"
81-
], service)
82-
]) == 0
83-
}
8470
}
8571

8672
variable "cloud_service_by_crn" {

main.tf

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,33 @@ locals {
5353

5454
# Map of Services to endpoints
5555
service_to_endpoint_map = {
56-
kms = "crn:v1:bluemix:public:kms:${var.region}:::endpoint:${var.service_endpoints}.${var.region}.kms.cloud.ibm.com"
57-
hs-crypt = "crn:v1:bluemix:public:hs-crypto:${var.region}:::endpoint:api.${var.service_endpoints}.${var.region}.hs-crypto.cloud.ibm.com"
58-
cloud-object-storage = "crn:v1:bluemix:public:cloud-object-storage:global:::endpoint:s3.direct.${var.region}.cloud-object-storage.appdomain.cloud"
59-
container-registry = "crn:v1:bluemix:public:container-registry:${var.region}:::endpoint:vpe.${var.region}.container-registry.cloud.ibm.com"
56+
account-management = "crn:v1:bluemix:public:account-management:global:::endpoint:${var.service_endpoints}.accounts.cloud.ibm.com"
57+
billing = "crn:v1:bluemix:public:billing:global:::endpoint:${var.service_endpoints}.billing.cloud.ibm.com"
58+
cloud-object-storage = "crn:v1:bluemix:public:cloud-object-storage:global:::endpoint:s3.direct.${var.region}.cloud-object-storage.appdomain.cloud"
59+
codeengine = "crn:v1:bluemix:public:codeengine:${var.region}:::endpoint:${var.service_endpoints}.${var.region}.codeengine.cloud.ibm.com"
60+
container-registry = "crn:v1:bluemix:public:container-registry:${var.region}:::endpoint:vpe.${var.region}.container-registry.cloud.ibm.com"
61+
databases-for-cassandra = "crn:v1:bluemix:public:databases-for-cassandra:${var.region}:::endpoint:${var.service_endpoints}.databases-for-cassandra.cloud.ibm.com"
62+
databases-for-elasticsearch = "crn:v1:bluemix:public:databases-for-elasticsearch:${var.region}:::endpoint:${var.service_endpoints}.databases-for-elasticsearch.cloud.ibm.com"
63+
databases-for-enterprisedb = "crn:v1:bluemix:public:databases-for-enterprisedb:${var.region}:::${var.service_endpoints}.databases-for-enterprisedb.cloud.ibm.com"
64+
databases-for-mongodb = "crn:v1:bluemix:public:databases-for-mongodb:${var.region}:::endpoint:${var.service_endpoints}.databases-for-mongodb.cloud.ibm.com"
65+
databases-for-postgresql = "crn:v1:bluemix:public:databases-for-postgresql:${var.region}:::endpoint:${var.service_endpoints}.databases-for-postgresql.cloud.ibm.com"
66+
databases-for-redis = "crn:v1:bluemix:public:databases-for-redis:${var.region}:::endpoint:${var.service_endpoints}.databases-for-redis.cloud.ibm.com"
67+
directlink = "crn:v1:bluemix:public:directlink:global:::endpoint:${var.service_endpoints}.directlink.cloud.ibm.com"
68+
dns-svcs = "crn:v1:bluemix:public:dns-svcs:global::::"
69+
enterprise = "crn:v1:bluemix:public:enterprise:global:::endpoint:${var.service_endpoints}.enterprise.cloud.ibm.com"
70+
global-search-tagging = "crn:v1:bluemix:public:global-search-tagging:global:::endpoint:api.${var.service_endpoints}.global-search-tagging.cloud.ibm.com"
71+
globalcatalog = "crn:v1:bluemix:public:globalcatalog:global:::endpoint:${var.service_endpoints}.globalcatalog.cloud.ibm.com"
72+
hs-crypto = "crn:v1:bluemix:public:hs-crypto:${var.region}:::endpoint:api.${var.service_endpoints}.${var.region}.hs-crypto.cloud.ibm.com"
73+
hyperp-dbaas-mongodb = "crn:v1:bluemix:public:hyperp-dbaas-mongodb:${var.region}:::endpoint:dbaas900-mongodb.${var.service_endpoints}.hyperp-dbaas.cloud.ibm.com"
74+
hyperp-dbaas-postgresql = "crn:v1:bluemix:public:hyperp-dbaas-postgresql:${var.region}:::endpoint:dbaas900-postgresql.${var.service_endpoints}.hyperp-dbaas.cloud.ibm.com"
75+
iam-identity = "crn:v1:bluemix:public:iam-identity:global:::endpoint:${var.service_endpoints}.iam.cloud.ibm.com"
76+
iam-svcs = "crn:v1:bluemix:public:iam-svcs:global:::endpoint:${var.service_endpoints}.iam.cloud.ibm.com"
77+
is = "crn:v1:bluemix:public:is:${var.region}:::endpoint:${var.region}.${var.service_endpoints}.iaas.cloud.ibm.com"
78+
kms = "crn:v1:bluemix:public:kms:${var.region}:::endpoint:${var.service_endpoints}.${var.region}.kms.cloud.ibm.com"
79+
resource-controller = "crn:v1:bluemix:public:resource-controller:global:::endpoint:${var.service_endpoints}.resource-controller.cloud.ibm.com"
80+
secrets-manager = "crn:v1:bluemix:public:secrets-manager:${var.region}:::endpoint:${var.service_endpoints}.secrets-manager.cloud.ibm.com"
81+
transit = "crn:v1:bluemix:public:transit:global:::endpoint:${var.service_endpoints}.transit.cloud.ibm.com"
82+
user-management = "crn:v1:bluemix:public:user-management:global:::endpoint:${var.service_endpoints}.user-management.cloud.ibm.com"
6083
}
6184
}
6285

module-metadata.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"default": [],
99
"pos": {
1010
"filename": "variables.tf",
11-
"line": 80
11+
"line": 103
1212
}
1313
},
1414
"cloud_services": {
@@ -90,7 +90,7 @@
9090
"default": "private",
9191
"pos": {
9292
"filename": "variables.tf",
93-
"line": 91
93+
"line": 114
9494
}
9595
},
9696
"subnet_zone_list": {
@@ -167,7 +167,7 @@
167167
},
168168
"pos": {
169169
"filename": "main.tf",
170-
"line": 69
170+
"line": 92
171171
}
172172
},
173173
"ibm_is_virtual_endpoint_gateway.vpe": {
@@ -185,7 +185,7 @@
185185
},
186186
"pos": {
187187
"filename": "main.tf",
188-
"line": 84
188+
"line": 107
189189
}
190190
},
191191
"ibm_is_virtual_endpoint_gateway_ip.endpoint_gateway_ip": {
@@ -197,7 +197,7 @@
197197
},
198198
"pos": {
199199
"filename": "main.tf",
200-
"line": 102
200+
"line": 125
201201
}
202202
}
203203
},

tests/pr_test.go

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,30 @@ import (
1212
const resourceGroup = "geretain-test-resources"
1313
const defaultExampleTerraformDir = "examples/default"
1414

15+
const region = "us-south"
16+
1517
func setupOptions(t *testing.T, prefix string, dir string) *testhelper.TestOptions {
18+
cloudServices := []string{
19+
"account-management",
20+
"billing",
21+
"cloud-object-storage",
22+
"codeengine",
23+
"directlink",
24+
"dns-svcs",
25+
"enterprise",
26+
"global-search-tagging",
27+
"globalcatalog",
28+
"hs-crypto",
29+
"hyperp-dbaas-mongodb",
30+
"hyperp-dbaas-postgresql",
31+
"iam-svcs",
32+
"is",
33+
"kms",
34+
"resource-controller",
35+
"transit",
36+
"user-management",
37+
}
38+
1639
options := testhelper.TestOptionsDefaultWithVars(&testhelper.TestOptions{
1740
Testing: t,
1841
TerraformDir: dir,
@@ -23,6 +46,10 @@ func setupOptions(t *testing.T, prefix string, dir string) *testhelper.TestOptio
2346
},
2447
},
2548
ResourceGroup: resourceGroup,
49+
TerraformVars: map[string]interface{}{
50+
"region": region,
51+
"cloud_services": cloudServices,
52+
},
2653
})
2754
return options
2855
}

variables.tf

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,14 +64,37 @@ variable "cloud_services" {
6464
default = ["kms", "cloud-object-storage"]
6565

6666
validation {
67-
error_message = "Currently the only supported services are Key Protect (`kms`), Cloud Object Storage (`cloud-object-storage`), Container Registry (`container-registry`), and Hyper Protect Crypto Services (`hs-crypto`). Any other VPE services must be added using `cloud_service_by_crn`."
67+
error_message = "Currently the service you're trying to add is not supported. Any other VPE services must be added using `cloud_service_by_crn`."
6868
condition = length(var.cloud_services) == 0 ? true : length([
6969
for service in var.cloud_services :
7070
service if !contains([
71-
"kms",
72-
"hs-crypto",
71+
"account-management",
72+
"billing",
7373
"cloud-object-storage",
74-
"container-registry"
74+
"codeengine",
75+
"container-registry",
76+
"databases-for-cassandra",
77+
"databases-for-elasticsearch",
78+
"databases-for-enterprisedb",
79+
"databases-for-mongodb",
80+
"databases-for-postgresql",
81+
"databases-for-redis",
82+
"directlink",
83+
"dns-svcs",
84+
"enterprise",
85+
"global-search-tagging",
86+
"globalcatalog",
87+
"hs-crypto",
88+
"hyperp-dbaas-mongodb",
89+
"hyperp-dbaas-postgresql",
90+
"iam-identity",
91+
"iam-svcs",
92+
"is",
93+
"kms",
94+
"resource-controller",
95+
"secrets-manager",
96+
"transit",
97+
"user-management",
7598
], service)
7699
]) == 0
77100
}

0 commit comments

Comments
 (0)