Skip to content

Commit b041443

Browse files
author
akocbek
committed
feat: update DAs to allign with best practices
1 parent 43363b4 commit b041443

File tree

15 files changed

+237
-337
lines changed

15 files changed

+237
-337
lines changed

ibm_catalog.json

Lines changed: 140 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -19,35 +19,35 @@
1919
"terraform",
2020
"solution"
2121
],
22-
"short_description": "Provisions and configures IBM Cloud Code Engine",
23-
"long_description": "Creates an instance of IBM Cloud Code Engine and configures the project, applications, domain mappings, secrets, configmaps, and service bindings.",
22+
"short_description": "Provisions and configures Serverless on IBM Cloud",
23+
"long_description": "Creates an instance of [Serverless on IBM Cloud](https://www.ibm.com/products/code-engine) and configures the project, applications, domain mappings, secrets, configmaps, and service bindings. It enables you to manage IBM Cloud Code Engine’s fully managed, serverless platform using infrastructure as code for scalable, cloud-native workloads.\n\nℹ️ This Terraform-based automation is part of a broader suite of IBM-maintained Infrastructure as Code (IaC) assets, each following the naming pattern \"Cloud automation for *servicename*\" and focusing on single IBM Cloud service. These single-service deployable architectures can be used on their own to streamline and automate service deployments through an [IaC approach](https://cloud.ibm.com/docs/secure-enterprise?topic=secure-enterprise-understanding-projects), or assembled together into a broader [automated IaC stack](https://cloud.ibm.com/docs/secure-enterprise?topic=secure-enterprise-config-stack) to automate the deployment of an end-to-end solution architecture.",
2424
"offering_docs_url": "https://github.com/terraform-ibm-modules/terraform-ibm-code-engine/blob/main/README.md",
2525
"offering_icon_url": "https://raw.githubusercontent.com/terraform-ibm-modules/terraform-ibm-code-engine/main/images/code-engine.svg",
2626
"provider_name": "IBM",
2727
"features": [
2828
{
29-
"title": "Creates a Code Engine project",
30-
"description": "Code Engine project group, manage, and provide access for Code Engine resources such as applications, jobs, and builds."
29+
"title": "Project",
30+
"description": "[A Code Engine project](https://cloud.ibm.com/docs/codeengine?topic=codeengine-manage-project) groups, manages, and provides access to Code Engine resources such as applications, jobs, and builds."
3131
},
3232
{
33-
"title": "Creates Code Engine applications",
34-
"description": "Code Engine applications serve HTTP requests or WebSockets as their communications protocol. The number of running instances of an app are scaled up or down as required by the workdloads."
33+
"title": "Applications",
34+
"description": "[Code Engine applications](https://cloud.ibm.com/docs/codeengine?topic=codeengine-application-workloads) serve HTTP requests or WebSockets as their communications protocol. The number of running instances of an app are scaled up or down as required by the workdloads."
3535
},
3636
{
37-
"title": "Creates custom domain mappings",
38-
"description": "Creates the mappings from your custom domain to your Code Engine application in a project to route requests from your custom URL to your application."
37+
"title": "Custom domain mappings",
38+
"description": "Creates the [mappings](https://cloud.ibm.com/docs/codeengine?topic=codeengine-domain-mappings) from your custom domain to your Code Engine application in a project to route requests from your custom URL to your application."
3939
},
4040
{
41-
"title": "Creates Code Engine secrets",
42-
"description": "Code Engine secrets provide a method to include sensitive configuration information, such as passwords or SSH keys, in your deployment."
41+
"title": "Secrets",
42+
"description": "[Code Engine secrets](https://cloud.ibm.com/docs/codeengine?topic=codeengine-secret) provide a method to include sensitive configuration information, such as passwords or SSH keys, in your deployment."
4343
},
4444
{
45-
"title": "Creates Code Engine configmaps",
46-
"description": "Configmaps provide a method to include nonsensitive data information in your deployment. By referencing values from your configmap as environment variables, you can decouple specific information from your deployment and keep your application portable."
45+
"title": "Configmaps",
46+
"description": "[Code Engine Configmaps](https://cloud.ibm.com/docs/codeengine?topic=codeengine-configmap) provide a method to include nonsensitive data information in your deployment. By referencing values from your configmap as environment variables, you can decouple specific information from your deployment and keep your application portable."
4747
},
4848
{
49-
"title": "Creates Code Engine service bindings",
50-
"description": "Service bindings provide access from your application to other IBM Cloud services."
49+
"title": "Service bindings",
50+
"description": "[Code engine service bindings](https://cloud.ibm.com/docs/codeengine?topic=codeengine-service-binding) provide access from your application to other IBM Cloud services."
5151
}
5252
],
5353
"support_details": "This product is in the community registry, as such support is handled through the originated repo. If you experience issues please open an issue in that repository [https://github.com/terraform-ibm-modules/terraform-ibm-code-engine/issues](https://github.com/terraform-ibm-modules/terraform-ibm-code-engine/issues). Please note this product is not supported via the IBM Cloud Support Center.",
@@ -67,6 +67,13 @@
6767
]
6868
},
6969
"iam_permissions": [
70+
{
71+
"role_crns": [
72+
"crn:v1:bluemix:public:iam::::role:Viewer"
73+
],
74+
"service_name": "Resource group only",
75+
"notes": "Viewer access is required in the resource group you want to provision in."
76+
},
7077
{
7178
"role_crns": [
7279
"crn:v1:bluemix:public:iam::::serviceRole:Writer"
@@ -124,6 +131,7 @@
124131
},
125132
{
126133
"key": "provider_visibility",
134+
"hidden": true,
127135
"options": [
128136
{
129137
"displayname": "private",
@@ -157,17 +165,48 @@
157165
},
158166
{
159167
"key": "region",
160-
"type": "string",
161-
"custom_config": {
162-
"type": "region",
163-
"grouping": "deployment",
164-
"original_grouping": "deployment",
165-
"config_constraints": {
166-
"showKinds": [
167-
"region"
168-
]
168+
"options": [
169+
{
170+
"displayname": "Dallas (us-south)",
171+
"value": "us-south"
172+
},
173+
{
174+
"displayname": "Frankfurt (eu-de)",
175+
"value": "eu-de"
176+
},
177+
{
178+
"displayname": "London (eu-gb)",
179+
"value": "eu-gb"
180+
},
181+
{
182+
"displayname": "Osaka (jp-osa)",
183+
"value": "jp-osa"
184+
},
185+
{
186+
"displayname": "Sao Paulo (br-sao)",
187+
"value": "br-sao"
188+
},
189+
{
190+
"displayname": "Spain (us-es)",
191+
"value": "us-es"
192+
},
193+
{
194+
"displayname": "Sydney (au-syd)",
195+
"value": "au-syd"
196+
},
197+
{
198+
"displayname": "Tokyo (jp-tok)",
199+
"value": "jp-tok"
200+
},
201+
{
202+
"displayname": "Toronto (ca-tor)",
203+
"value": "ca-tor"
204+
},
205+
{
206+
"displayname": "Washington DC (us-east)",
207+
"value": "us-east"
169208
}
170-
}
209+
]
171210
},
172211
{
173212
"key": "project_name"
@@ -185,10 +224,22 @@
185224
"key": "image_secret"
186225
},
187226
{
188-
"key": "run_env_variables"
227+
"key": "run_env_variables",
228+
"type": "array",
229+
"custom_config": {
230+
"type": "textarea",
231+
"grouping": "deployment",
232+
"original_grouping": "deployment"
233+
}
189234
},
190235
{
191-
"key": "run_volume_mounts"
236+
"key": "run_volume_mounts",
237+
"type": "array",
238+
"custom_config": {
239+
"type": "textarea",
240+
"grouping": "deployment",
241+
"original_grouping": "deployment"
242+
}
192243
},
193244
{
194245
"key": "image_port"
@@ -251,7 +302,13 @@
251302
"key": "bindings"
252303
},
253304
{
254-
"key": "cbr_rules"
305+
"key": "cbr_rules",
306+
"type": "array",
307+
"custom_config": {
308+
"type": "textarea",
309+
"grouping": "deployment",
310+
"original_grouping": "deployment"
311+
}
255312
}
256313
]
257314
},
@@ -261,6 +318,13 @@
261318
"install_type": "fullstack",
262319
"working_directory": "solutions/project",
263320
"iam_permissions": [
321+
{
322+
"role_crns": [
323+
"crn:v1:bluemix:public:iam::::role:Viewer"
324+
],
325+
"service_name": "Resource group only",
326+
"notes": "Viewer access is required in the resource group you want to provision in."
327+
},
264328
{
265329
"role_crns": [
266330
"crn:v1:bluemix:public:iam::::serviceRole:Writer"
@@ -298,6 +362,7 @@
298362
},
299363
{
300364
"key": "provider_visibility",
365+
"hidden": true,
301366
"options": [
302367
{
303368
"displayname": "private",
@@ -334,20 +399,57 @@
334399
},
335400
{
336401
"key": "region",
337-
"type": "string",
338-
"custom_config": {
339-
"type": "region",
340-
"grouping": "deployment",
341-
"original_grouping": "deployment",
342-
"config_constraints": {
343-
"showKinds": [
344-
"region"
345-
]
402+
"options": [
403+
{
404+
"displayname": "Dallas (us-south)",
405+
"value": "us-south"
406+
},
407+
{
408+
"displayname": "Frankfurt (eu-de)",
409+
"value": "eu-de"
410+
},
411+
{
412+
"displayname": "London (eu-gb)",
413+
"value": "eu-gb"
414+
},
415+
{
416+
"displayname": "Osaka (jp-osa)",
417+
"value": "jp-osa"
418+
},
419+
{
420+
"displayname": "Sao Paulo (br-sao)",
421+
"value": "br-sao"
422+
},
423+
{
424+
"displayname": "Spain (us-es)",
425+
"value": "us-es"
426+
},
427+
{
428+
"displayname": "Sydney (au-syd)",
429+
"value": "au-syd"
430+
},
431+
{
432+
"displayname": "Tokyo (jp-tok)",
433+
"value": "jp-tok"
434+
},
435+
{
436+
"displayname": "Toronto (ca-tor)",
437+
"value": "ca-tor"
438+
},
439+
{
440+
"displayname": "Washington DC (us-east)",
441+
"value": "us-east"
346442
}
347-
}
443+
]
348444
},
349445
{
350-
"key": "cbr_rules"
446+
"key": "cbr_rules",
447+
"type": "array",
448+
"custom_config": {
449+
"type": "textarea",
450+
"grouping": "deployment",
451+
"original_grouping": "deployment"
452+
}
351453
},
352454
{
353455
"key": "builds"

reference-architecture/ce-app-da.svg

Lines changed: 1 addition & 1 deletion
Loading

reference-architecture/ce-project-da.svg

Lines changed: 1 addition & 238 deletions
Loading

solutions/apps/DA-cbr_rules.md

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,7 @@ The `cbr_rules` input variable allows you to provide a rule for the target servi
3434
### Example Rule For Context-Based Restrictions Configuration
3535

3636
```hcl
37-
cbr_rules = [
38-
{
37+
{
3938
description = "Code Engine can be accessed from xyz"
4039
account_id = "defc0df06b644a9cabc6e44f55b3880s"
4140
rule_contexts= [{
@@ -54,9 +53,8 @@ cbr_rules = [
5453
enforcement_mode = "enabled"
5554
operations = [{
5655
api_types = [{
57-
api_type_id = "crn:v1:bluemix:public:context-based-restrictions::::platform-api-type:"
58-
}]
56+
api_type_id = "crn:v1:bluemix:public:context-based-restrictions::::platform-api-type:"
5957
}]
60-
}
61-
]
58+
}]
59+
}
6260
```

solutions/apps/DA-inputs.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ The `domain_mappings` input variable allows you to provide the URL route to your
2424
### Example for Domain Mapping
2525

2626
```hcl
27-
domain_mappings = {
27+
{
2828
"www.example.com" = {
2929
components = {
3030
name = "my-app-1"
@@ -51,7 +51,7 @@ The `config_maps` input variable allows you to provide a method to include non-s
5151
### Example for Config Maps
5252

5353
```hcl
54-
config_maps = {
54+
{
5555
"your-config-name" = {
5656
data = { "key_1" : "value_1", "key_2" : "value_2" }
5757
}
@@ -76,7 +76,7 @@ The `secrets` input variable allows you to provide a method to include sensitive
7676
### Example for Secrets
7777

7878
```hcl
79-
secrets = {
79+
{
8080
"your-secret-name" = {
8181
format = "generic"
8282
data = { "key_1" : "value_1", "key_2" : "value_2" }

solutions/apps/README.md

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,3 @@
1-
# IBM Cloud Code Engine apps deployable architecture
1+
# Cloud automation for Code Engine apps
22

3-
This deployable architecture creates IBM Cloud Code Engine apps and supports provisioning Code Engine project apps and the following optional resources:
4-
5-
- A resource group.
6-
- A Code Engine project.
7-
- Code Engine project secrets.
8-
- Code Engine project configmaps.
9-
- Code Engine project service bindings.
10-
- Code Engine project domain mappings.
11-
12-
![ce-apps-da](../../reference-architecture/ce-app-da.svg)
3+
:exclamation: **Important:** This solution is not intended to be called by other modules because it contains a provider configuration and is not compatible with the `for_each`, `count`, and `depends_on` arguments. For more information, see [Providers Within Modules](https://developer.hashicorp.com/terraform/language/modules/develop/providers).

solutions/apps/main.tf

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ module "resource_group" {
99
}
1010

1111
locals {
12-
prefix = var.prefix != null ? trimspace(var.prefix) != "" ? "${var.prefix}-" : "" : ""
12+
prefix = var.prefix != null ? trimspace(var.prefix) != "" ? "${var.prefix}-" : "" : ""
13+
project_name = var.project_name != null ? "${local.prefix}${var.project_name}" : null
1314
}
1415

1516
########################################################################################################################
@@ -19,7 +20,7 @@ locals {
1920
module "code_engine" {
2021
source = "../.."
2122
resource_group_id = module.resource_group.resource_group_id
22-
project_name = var.project_name != null ? "${local.prefix}${var.project_name}" : null
23+
project_name = local.project_name
2324
existing_project_id = var.existing_project_id
2425
cbr_rules = var.cbr_rules
2526
apps = {

solutions/apps/provider.tf

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
########################################################################################################################
44

55
provider "ibm" {
6-
ibmcloud_api_key = var.ibmcloud_api_key
7-
region = var.region
8-
visibility = var.provider_visibility
6+
ibmcloud_api_key = var.ibmcloud_api_key
7+
region = var.region
8+
visibility = var.provider_visibility
9+
private_endpoint_type = (var.provider_visibility == "private" && var.region == "ca-mon") ? "vpe" : null
910
}

0 commit comments

Comments
 (0)