Skip to content
This repository was archived by the owner on Jun 17, 2025. It is now read-only.

Commit cb76120

Browse files
authored
feat: Root module updates:<br> * existing_kms_instance_guid is no longer a supported input. The code will now parse the GUID from the KMS key CRN<br> * added new input use_same_kms_key_for_backups to give more control over KMS key usage<br> * kms_encryption_enabled has been renamed to use_ibm_owned_encryption_key<br>* fscloud submodule updates:<br> * added new inputs use_default_backup_encryption_key and use_same_kms_key_for_backups (#320)
1 parent 68fb5ae commit cb76120

File tree

14 files changed

+336
-191
lines changed

14 files changed

+336
-191
lines changed

README.md

Lines changed: 13 additions & 6 deletions
Large diffs are not rendered by default.

cra-config.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ 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:
8-
TF_VAR_existing_kms_instance_guid: "e6dce284-e80f-46e1-a3c1-830f7adff7a9"
98
TF_VAR_kms_key_crn: "crn:v1:bluemix:public:hs-crypto:us-south:a/abac0df06b644a9cabc6e44f55b3880e:e6dce284-e80f-46e1-a3c1-830f7adff7a9:key:76170fae-4e0c-48c3-8ebe-326059ebb533"
109
# SCC_INSTANCE_ID: "" # The SCC instance ID to use to download profile for CRA scan. If not provided, a default global value will be used.
1110
# SCC_REGION: "" # The IBM Cloud region that the SCC instance is in. If not provided, a default global value will be used.

examples/complete/main.tf

Lines changed: 31 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@ module "resource_group" {
1414
# Key Protect All Inclusive
1515
##############################################################################
1616

17+
locals {
18+
data_key_name = "${var.prefix}-enterprisedb"
19+
backups_key_name = "${var.prefix}-enterprisedb-backups"
20+
}
21+
1722
module "key_protect_all_inclusive" {
1823
source = "terraform-ibm-modules/kms-all-inclusive/ibm"
1924
version = "4.19.2"
@@ -28,7 +33,11 @@ module "key_protect_all_inclusive" {
2833
key_ring_name = "icd-edb"
2934
keys = [
3035
{
31-
key_name = "${var.prefix}-edb"
36+
key_name = local.data_key_name
37+
force_delete = true
38+
},
39+
{
40+
key_name = local.backups_key_name
3241
force_delete = true
3342
}
3443
]
@@ -80,20 +89,27 @@ module "cbr_zone" {
8089
##############################################################################
8190

8291
module "enterprise_db" {
83-
source = "../../"
84-
resource_group_id = module.resource_group.resource_group_id
85-
name = "${var.prefix}-edb"
86-
region = var.region
87-
edb_version = var.edb_version
88-
admin_pass = var.admin_pass
89-
users = var.users
90-
kms_encryption_enabled = true
91-
kms_key_crn = module.key_protect_all_inclusive.keys["icd-edb.${var.prefix}-edb"].crn
92-
existing_kms_instance_guid = module.key_protect_all_inclusive.kms_guid
93-
resource_tags = var.resource_tags
94-
service_credential_names = var.service_credential_names
95-
access_tags = var.access_tags
96-
member_host_flavor = "b3c.4x16.encrypted"
92+
source = "../../"
93+
resource_group_id = module.resource_group.resource_group_id
94+
name = "${var.prefix}-edb"
95+
region = var.region
96+
edb_version = var.edb_version
97+
admin_pass = var.admin_pass
98+
users = var.users
99+
resource_tags = var.resource_tags
100+
# Example of how to use different KMS keys for data and backups
101+
use_ibm_owned_encryption_key = false
102+
use_same_kms_key_for_backups = false
103+
kms_key_crn = module.key_protect_all_inclusive.keys["icd-edb.${var.prefix}-edb"].crn
104+
backup_encryption_key_crn = module.key_protect_all_inclusive.keys["icd.${local.data_key_name}"].crn
105+
service_credential_names = {
106+
"enterprisedb_admin" : "Administrator",
107+
"enterprisedb_operator" : "Operator",
108+
"enterprisedb_viewer" : "Viewer",
109+
"enterprisedb_editor" : "Editor",
110+
}
111+
access_tags = var.access_tags
112+
member_host_flavor = "b3c.4x16.encrypted"
97113
configuration = {
98114
max_connections = 250
99115
}

examples/complete/variables.tf

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -58,14 +58,3 @@ variable "users" {
5858
sensitive = true
5959
description = "A list of users that you want to create on the database. Multiple blocks are allowed. The user password must be in the range of 10-32 characters."
6060
}
61-
62-
variable "service_credential_names" {
63-
description = "Map of name, role for service credentials that you want to create for the database"
64-
type = map(string)
65-
default = {
66-
"enterprise_db_admin" : "Administrator",
67-
"enterprise_db_operator" : "Operator",
68-
"enterprise_db_viewer" : "Viewer",
69-
"enterprise_db_editor" : "Editor",
70-
}
71-
}

examples/fscloud/main.tf

Lines changed: 26 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -54,20 +54,32 @@ module "cbr_zone" {
5454
##############################################################################
5555

5656
module "enterprise_db" {
57-
source = "../../modules/fscloud"
58-
resource_group_id = module.resource_group.resource_group_id
59-
name = "${var.prefix}-edb"
60-
region = var.region
61-
edb_version = var.edb_version
62-
kms_key_crn = var.kms_key_crn
63-
existing_kms_instance_guid = var.existing_kms_instance_guid
64-
resource_tags = var.resource_tags
65-
service_credential_names = var.service_credential_names
66-
access_tags = var.access_tags
67-
auto_scaling = var.auto_scaling
68-
member_host_flavor = "b3c.4x16.encrypted"
69-
backup_encryption_key_crn = var.backup_encryption_key_crn
70-
backup_crn = var.backup_crn
57+
source = "../../modules/fscloud"
58+
resource_group_id = module.resource_group.resource_group_id
59+
name = "${var.prefix}-edb"
60+
region = var.region
61+
edb_version = var.edb_version
62+
resource_tags = var.resource_tags
63+
kms_key_crn = var.kms_key_crn
64+
backup_encryption_key_crn = var.backup_encryption_key_crn
65+
backup_crn = var.backup_crn
66+
service_credential_names = {
67+
"enterprisedb_admin" : "Administrator",
68+
"enterprisedb_operator" : "Operator",
69+
"enterprisedb_viewer" : "Viewer",
70+
"enterprisedb_editor" : "Editor",
71+
}
72+
auto_scaling = {
73+
disk = {
74+
capacity_enabled : true,
75+
io_enabled : true
76+
}
77+
memory = {
78+
io_enabled : true,
79+
}
80+
}
81+
member_host_flavor = "b3c.4x16.encrypted"
82+
access_tags = var.access_tags
7183
cbr_rules = [
7284
{
7385
description = "${var.prefix}-edb access only from vpc"

examples/fscloud/variables.tf

Lines changed: 0 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -40,62 +40,11 @@ variable "edb_version" {
4040
default = null
4141
}
4242

43-
variable "existing_kms_instance_guid" {
44-
description = "The GUID of the Hyper Protect Crypto services in which the key specified in var.kms_key_crn is coming from"
45-
type = string
46-
}
47-
4843
variable "kms_key_crn" {
4944
type = string
5045
description = "The root key CRN of a Hyper Protect Crypto Services (HPCS) that you want to use for disk encryption. See https://cloud.ibm.com/docs/cloud-databases?topic=cloud-databases-hpcs&interface=ui for more information on integrating HPCS with Enterprise database."
5146
}
5247

53-
variable "service_credential_names" {
54-
description = "Map of name, role for service credentials that you want to create for the database"
55-
type = map(string)
56-
default = {
57-
"enterprise_db_admin" : "Administrator",
58-
"enterprise_db_operator" : "Operator",
59-
"enterprise_db_viewer" : "Viewer",
60-
"enterprise_db_editor" : "Editor",
61-
}
62-
}
63-
64-
variable "auto_scaling" {
65-
type = object({
66-
disk = object({
67-
capacity_enabled = optional(bool)
68-
free_space_less_than_percent = optional(number)
69-
io_above_percent = optional(number)
70-
io_enabled = optional(bool)
71-
io_over_period = optional(string)
72-
rate_increase_percent = optional(number)
73-
rate_limit_mb_per_member = optional(number)
74-
rate_period_seconds = optional(number)
75-
rate_units = optional(string)
76-
})
77-
memory = object({
78-
io_above_percent = optional(number)
79-
io_enabled = optional(bool)
80-
io_over_period = optional(string)
81-
rate_increase_percent = optional(number)
82-
rate_limit_mb_per_member = optional(number)
83-
rate_period_seconds = optional(number)
84-
rate_units = optional(string)
85-
})
86-
})
87-
description = "Optional rules to allow the database to increase resources in response to usage. Only a single autoscaling block is allowed. Make sure you understand the effects of autoscaling, especially for production environments. See https://ibm.biz/autoscaling-considerations in the IBM Cloud Docs."
88-
default = {
89-
disk = {
90-
capacity_enabled : true,
91-
io_enabled : true
92-
}
93-
memory = {
94-
io_enabled : true,
95-
}
96-
}
97-
}
98-
9948
variable "backup_crn" {
10049
type = string
10150
description = "The CRN of a backup resource to restore from. The backup is created by a database deployment with the same service ID. The backup is loaded after provisioning and the new deployment starts up that uses that data. A backup CRN is in the format crn:v1:<…>:backup:. If omitted, the database is provisioned empty."

0 commit comments

Comments
 (0)