Skip to content

Commit 4e6afa4

Browse files
authored
feat: enable the DA with add-ons config (#66)
1 parent f1d27d8 commit 4e6afa4

File tree

9 files changed

+177
-106
lines changed

9 files changed

+177
-106
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ terraform.rc
5151

5252
# Visual Studio Code
5353
.vscode/
54+
*.code-workspace
5455

5556
### Go ###
5657
# Binaries for programs and plugins

cra-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ CRA_TARGETS:
55
CRA_IGNORE_RULES_FILE: "cra-tf-validate-ignore-rules.json" # CRA Ignore file to use. If not provided, it checks the repo root directory for `cra-tf-validate-ignore-rules.json`
66
PROFILE_ID: "fe96bd4d-9b37-40f2-b39f-a62760e326a3" # SCC profile ID (currently set to 'IBM Cloud Framework for Financial Services' '1.7.0' profile).
77
CRA_ENVIRONMENT_VARIABLES: # An optional map of environment variables for CRA, where the key is the variable name and value is the value. Useful for providing TF_VARs.
8-
TF_VAR_prefix: "prefix"
8+
TF_VAR_prefix: "cra"
99
TF_VAR_db2_instance_name: "db2-da"
1010
TF_VAR_existing_resource_group_name: "geretain-test-resources"
1111
TF_VAR_provider_visibility: "public"

ibm_catalog.json

Lines changed: 123 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
"integration",
1010
"target_terraform",
1111
"terraform",
12-
"solution"
12+
"solution",
13+
"application_modernization"
1314
],
1415
"keywords": [
1516
"DB2",
@@ -20,14 +21,14 @@
2021
"solution"
2122
],
2223
"short_description": "Creates and configures IBM Cloud DB2 on Cloud resources",
23-
"long_description": "This architecture supports creating and configuring an IBM DB2 on Cloud service instance.",
24+
"long_description": "IBM Cloud DB2 on Cloud is an end-to-end solution to creating and configuring an IBM DB2 on Cloud service instance.<br/>This architecture supports deploying an instance of DB2 on Cloud on cloud together with optional observability cloud services.<br/>br/>ℹ️ 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.",
2425
"offering_docs_url": "https://github.com/terraform-ibm-modules/terraform-ibm-db2-cloud/blob/main/solutions/fully-configurable/README.md",
2526
"offering_icon_url": "https://raw.githubusercontent.com/terraform-ibm-modules/terraform-ibm-db2-cloud/main/images/DB2.svg",
2627
"provider_name": "IBM",
2728
"features": [
2829
{
2930
"title": "Creates a DB2 on Cloud instance.",
30-
"description": "Creates and configures an DB2 on Cloud instance."
31+
"description": "Creates and configures a DB2 on Cloud instance."
3132
}
3233
],
3334
"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-db2-cloud/issues](https://github.com/terraform-ibm-modules/terraform-ibm-db2-cloud/issues). Please note this product is not supported via the IBM Cloud Support Center.",
@@ -46,13 +47,93 @@
4647
"service_name": "dashdb-for-transactions"
4748
}
4849
],
50+
"architecture": {
51+
"features": [
52+
{
53+
"title": " ",
54+
"description": "Configured to use IBM secure by default standards, but can be edited to fit your use case."
55+
}
56+
],
57+
"diagrams": [
58+
{
59+
"diagram": {
60+
"caption": "IBM DB2 on Cloud",
61+
"url": "https://raw.githubusercontent.com/terraform-ibm-modules/terraform-ibm-db2-cloud/main/reference-architectures/deployable-architecture-db2cloud.svg",
62+
"type": "image/svg+xml"
63+
},
64+
"description": "This architecture supports creating and configuring DB2 on Cloud resources"
65+
}
66+
]
67+
},
68+
"dependencies": [
69+
{
70+
"name": "deploy-arch-ibm-observability",
71+
"description": "Configure IBM Cloud Logs, Cloud Monitoring and Activity Tracker event routing for analysing logs and metrics generated by the DB2 on Cloud instance.",
72+
"flavors": [
73+
"instances"
74+
],
75+
"id": "a3137d28-79e0-479d-8a24-758ebd5a0eab-global",
76+
"catalog_id": "7a4d68b4-cf8b-40cd-a3d1-f49aff526eb3",
77+
"input_mapping": [
78+
{
79+
"dependency_input": "prefix",
80+
"version_input": "prefix",
81+
"reference_version": true
82+
},
83+
{
84+
"dependency_input": "enable_platform_metrics",
85+
"version_input": "enable_platform_metrics",
86+
"reference_version": true
87+
},
88+
{
89+
"dependency_input": "logs_routing_tenant_regions",
90+
"version_input": "logs_routing_tenant_regions",
91+
"reference_version": true
92+
},
93+
{
94+
"dependency_input": "region",
95+
"version_input": "region",
96+
"reference_version": true
97+
}
98+
],
99+
"optional": true,
100+
"on_by_default": true,
101+
"version": "v3.0.3"
102+
},
103+
{
104+
"name": "deploy-arch-ibm-account-infra-base",
105+
"description": "Cloud automation for account configuration organizes your IBM Cloud account with a ready-made set of resource groups by default. When you enable the “with account settings” option, it also applies baseline security and governance settings.",
106+
"catalog_id": "7a4d68b4-cf8b-40cd-a3d1-f49aff526eb3",
107+
"flavors": [
108+
"resource-group-only",
109+
"resource-groups-with-account-settings"
110+
],
111+
"default_flavor": "resource-group-only",
112+
"id": "63641cec-6093-4b4f-b7b0-98d2f4185cd6-global",
113+
"input_mapping": [
114+
{
115+
"dependency_input": "prefix",
116+
"version_input": "prefix",
117+
"reference_version": true
118+
},
119+
{
120+
"dependency_output": "workload_resource_group_name",
121+
"version_input": "existing_resource_group_name"
122+
}
123+
],
124+
"optional": true,
125+
"on_by_default": false,
126+
"version": "v3.0.7"
127+
}
128+
],
129+
"dependency_version_2": true,
49130
"configuration": [
50131
{
51-
"key": "ibmcloud_api_key",
52-
"required": true
132+
"key": "ibmcloud_api_key"
53133
},
54134
{
55135
"key": "provider_visibility",
136+
"hidden": true,
56137
"options": [
57138
{
58139
"displayname": "private",
@@ -70,7 +151,7 @@
70151
},
71152
{
72153
"key": "existing_resource_group_name",
73-
"required": true,
154+
"display_name": "resource_group",
74155
"custom_config": {
75156
"type": "resource_group",
76157
"grouping": "deployment",
@@ -130,12 +211,38 @@
130211
"key": "db2_instance_name",
131212
"required": true
132213
},
214+
{
215+
"key": "enable_platform_metrics",
216+
"type": "string",
217+
"default_value": "true",
218+
"description": "When set to `true`, the IBM Cloud Monitoring instance will be configured to collect platform metrics from the provided region. You can configure 1 instance only of the IBM Cloud Monitoring service per region to collect platform metrics in that location. Check with the account or service administrator if another monitoring instance has already been configured. You may not have permissions to see all monitoring instances in the region. [Learn more](https://cloud.ibm.com/docs/monitoring?topic=monitoring-platform_metrics_enabling).",
219+
"required": true,
220+
"virtual": true
221+
},
222+
{
223+
"key": "logs_routing_tenant_regions",
224+
"type": "list(string)",
225+
"default_value": "[]",
226+
"description": "To manage platform logs that are generated by IBM Cloud services in a region of IBM Cloud, you must create a tenant in each region that you operate. Pass a list of regions to create a tenant in. [Learn more](https://cloud.ibm.com/docs/logs-router?topic=logs-router-about-platform-logs).",
227+
"required": true,
228+
"virtual": true,
229+
"custom_config": {
230+
"grouping": "deployment",
231+
"original_grouping": "deployment",
232+
"config_constraints": {
233+
"type": "string"
234+
}
235+
}
236+
},
133237
{
134238
"key": "subscription_id"
135239
},
136240
{
137241
"key": "subscription_id_secret_crn"
138242
},
243+
{
244+
"key": "secrets_manager_ibmcloud_api_key"
245+
},
139246
{
140247
"key": "node_type",
141248
"options": [
@@ -198,34 +305,19 @@
198305
"key": "enable_high_availability"
199306
},
200307
{
201-
"key": "enable_oracle_compatibility"
308+
"key": "resource_tags",
309+
"custom_config": {
310+
"grouping": "deployment",
311+
"original_grouping": "deployment",
312+
"config_constraints": {
313+
"type": "string"
314+
}
315+
}
202316
},
203317
{
204-
"key": "resource_tags"
318+
"key": "enable_oracle_compatibility"
205319
}
206-
],
207-
"architecture": {
208-
"features": [
209-
{
210-
"title": "Creates an DB2 on Cloud instance.",
211-
"description": "Creates and configures an DB2 on Cloud instance."
212-
},
213-
{
214-
"title": "Creates a queue manager",
215-
"description": "Creates a queue manager"
216-
}
217-
],
218-
"diagrams": [
219-
{
220-
"diagram": {
221-
"caption": "IBM DB2 on Cloud",
222-
"url": "https://raw.githubusercontent.com/terraform-ibm-modules/terraform-ibm-db2-cloud/main/reference-architectures/deployable-architecture-db2cloud.svg",
223-
"type": "image/svg+xml"
224-
},
225-
"description": "This architecture supports creating and configuring DB on Cloud resources"
226-
}
227-
]
228-
}
320+
]
229321
}
230322
]
231323
}

reference-architectures/deployable-architecture-db2cloud.svg

Lines changed: 1 addition & 1 deletion
Loading
Lines changed: 1 addition & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,3 @@
1-
# Fully Configurable Solution
2-
3-
## Prerequisites
4-
- An existing resource group
5-
6-
This solution supports provisioning and configuring the following infrastructure:
7-
- A new DB2 instance on IBM Cloud.
1+
# Cloud automation for DB2 on Cloud (Fully configurable)
82

93
: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).
10-
11-
![db2-deployable-architecture](../../reference-architectures/deployable-architecture-db2cloud.svg)
12-
13-
<!-- Below content is automatically populated via pre-commit hook -->
14-
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
15-
### Requirements
16-
17-
| Name | Version |
18-
|------|---------|
19-
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.3.0 |
20-
| <a name="requirement_ibm"></a> [ibm](#requirement\_ibm) | 1.78.3 |
21-
22-
### Modules
23-
24-
| Name | Source | Version |
25-
|------|--------|---------|
26-
| <a name="module_crn_parser_subid"></a> [crn\_parser\_subid](#module\_crn\_parser\_subid) | terraform-ibm-modules/common-utilities/ibm//modules/crn-parser | 1.1.0 |
27-
| <a name="module_db2_instance"></a> [db2\_instance](#module\_db2\_instance) | ../.. | n/a |
28-
| <a name="module_resource_group"></a> [resource\_group](#module\_resource\_group) | terraform-ibm-modules/resource-group/ibm | 1.2.0 |
29-
30-
### Resources
31-
32-
| Name | Type |
33-
|------|------|
34-
| [ibm_sm_arbitrary_secret.sm_subscription_id](https://registry.terraform.io/providers/IBM-Cloud/ibm/1.78.3/docs/data-sources/sm_arbitrary_secret) | data source |
35-
36-
### Inputs
37-
38-
| Name | Description | Type | Default | Required |
39-
|------|-------------|------|---------|:--------:|
40-
| <a name="input_db2_instance_name"></a> [db2\_instance\_name](#input\_db2\_instance\_name) | The name of the DB2 instance | `string` | n/a | yes |
41-
| <a name="input_enable_high_availability"></a> [enable\_high\_availability](#input\_enable\_high\_availability) | Whether to enable high availability on the DB2 instance | `bool` | `true` | no |
42-
| <a name="input_enable_oracle_compatibility"></a> [enable\_oracle\_compatibility](#input\_enable\_oracle\_compatibility) | Whether to enable Oracle compatibility on the DB2 instance | `bool` | `false` | no |
43-
| <a name="input_existing_resource_group_name"></a> [existing\_resource\_group\_name](#input\_existing\_resource\_group\_name) | The name of an existing resource group in which to provision DB2 resources to. | `string` | `"Default"` | no |
44-
| <a name="input_ibmcloud_api_key"></a> [ibmcloud\_api\_key](#input\_ibmcloud\_api\_key) | The IBM Cloud API Key | `string` | n/a | yes |
45-
| <a name="input_node_type"></a> [node\_type](#input\_node\_type) | The node type of the DB2 instance, valid values are `bx2.1x4`, `bx2.4x16`, `bx2.8x32`, `bx2.16x64`, `bx2.32x128`, `bx2.48x192`, `mx2.4x32`, `mx2.16x128`, `mx2.128x1024` | `string` | `"bx2.4x16"` | no |
46-
| <a name="input_prefix"></a> [prefix](#input\_prefix) | The prefix to add to all resources that this solution creates. To not use any prefix value, you can set this value to `null` or an empty string. | `string` | n/a | yes |
47-
| <a name="input_provider_visibility"></a> [provider\_visibility](#input\_provider\_visibility) | Set the visibility value for the IBM terraform provider. Supported values are `public`, `private`, `public-and-private`. [Learn more](https://registry.terraform.io/providers/IBM-Cloud/ibm/latest/docs/guides/custom-service-endpoints). | `string` | `"private"` | no |
48-
| <a name="input_region"></a> [region](#input\_region) | Region to provision all resources created by this example | `string` | `"us-east"` | no |
49-
| <a name="input_resource_tags"></a> [resource\_tags](#input\_resource\_tags) | Optional list of tags to be added to created resources | `list(string)` | `[]` | no |
50-
| <a name="input_service_endpoints"></a> [service\_endpoints](#input\_service\_endpoints) | Service endpoints for the DB2 instance, valid values are `public`, `private`, or `public-and-private` | `string` | `"private"` | no |
51-
| <a name="input_subscription_id"></a> [subscription\_id](#input\_subscription\_id) | Value of the subscription ID to use with the subscription plan of DB2 | `string` | `null` | no |
52-
| <a name="input_subscription_id_secret_crn"></a> [subscription\_id\_secret\_crn](#input\_subscription\_id\_secret\_crn) | CRN of the secret which contains the subscription ID to use the subscription plan of DB2 | `string` | `null` | no |
53-
54-
### Outputs
55-
56-
| Name | Description |
57-
|------|-------------|
58-
| <a name="output_crn"></a> [crn](#output\_crn) | CRN of the DB2 instance |
59-
| <a name="output_dashboard_url"></a> [dashboard\_url](#output\_dashboard\_url) | Dashboard URL of the DB2 instance |
60-
| <a name="output_name"></a> [name](#output\_name) | Name of the DB2 instance |
61-
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->

solutions/fully-configurable/main.tf

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,10 @@ data "ibm_sm_arbitrary_secret" "sm_subscription_id" {
2424
}
2525

2626
locals {
27-
sm_region = var.subscription_id_secret_crn != null ? module.crn_parser_subid[0].region : ""
28-
subscription_id = var.subscription_id_secret_crn != null ? data.ibm_sm_arbitrary_secret.sm_subscription_id[0].payload : (var.subscription_id != null ? var.subscription_id : null)
29-
prefix = var.prefix != null ? (var.prefix != "" ? var.prefix : null) : null
27+
sm_region = var.subscription_id_secret_crn != null ? module.crn_parser_subid[0].region : ""
28+
sm_ibmcloud_api_key = var.secrets_manager_ibmcloud_api_key == null ? var.ibmcloud_api_key : var.secrets_manager_ibmcloud_api_key
29+
subscription_id = var.subscription_id_secret_crn != null ? data.ibm_sm_arbitrary_secret.sm_subscription_id[0].payload : (var.subscription_id != null ? var.subscription_id : null)
30+
prefix = var.prefix != null ? trimspace(var.prefix) != "" ? "${var.prefix}-" : "" : ""
3031
}
3132

3233
########################################################################################################################
@@ -36,7 +37,7 @@ locals {
3637
module "db2_instance" {
3738
source = "../.."
3839
region = var.region
39-
db2_instance_name = try("${local.prefix}-${var.db2_instance_name}", var.db2_instance_name)
40+
db2_instance_name = "${local.prefix}${var.db2_instance_name}"
4041
subscription_id = local.subscription_id
4142
resource_group_id = module.resource_group.resource_group_id
4243
service_endpoints = var.service_endpoints

solutions/fully-configurable/outputs.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,8 @@ output "name" {
1616
description = "Name of the DB2 instance"
1717
value = module.db2_instance.name
1818
}
19+
20+
output "resource_group_name" {
21+
description = "Resource group name where DB2 instance is created"
22+
value = module.resource_group.resource_group_name
23+
}

solutions/fully-configurable/provider.tf

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

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

1112
provider "ibm" {
12-
alias = "ibm-sm"
13-
ibmcloud_api_key = var.ibmcloud_api_key
14-
visibility = var.provider_visibility
15-
region = local.sm_region
13+
ibmcloud_api_key = local.sm_ibmcloud_api_key
14+
visibility = var.provider_visibility
15+
region = local.sm_region
16+
alias = "ibm-sm"
17+
private_endpoint_type = (var.provider_visibility == "private" && local.sm_region == "ca-mon") ? "vpe" : null
1618
}

0 commit comments

Comments
 (0)