You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: DA solution - added support for backups and backup encryption (#336) <br> - new DA input backup_crn to support creation from a backup <br> - new DA inputs existing_backup_kms_key_crn and existing_backup_kms_instance_crn to allow using a different encryption key for backups
* feat: add support to use a different KMS key for backup encryption
* fix: add policy
* fix: id instead of crn
---------
Co-authored-by: Jordan-Williams2 <[email protected]>
|[ibm_database_connection.database_connection](https://registry.terraform.io/providers/ibm-cloud/ibm/latest/docs/data-sources/database_connection)| data source |
Copy file name to clipboardExpand all lines: main.tf
+49-2Lines changed: 49 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -17,7 +17,11 @@ locals {
17
17
18
18
# For more info, see https://cloud.ibm.com/docs/cloud-databases?topic=cloud-databases-key-protect&interface=ui#key-byok and https://cloud.ibm.com/docs/cloud-databases?topic=cloud-databases-hpcs#use-hpcs-backups"
description="Allow all Elastic Search instances in the Resource Group ${var.resource_group_id} to read the ${local.kms_service} key ${local.backup_kms_key_id} from the instance GUID ${var.existing_kms_instance_guid}"
94
+
resource_attributes {
95
+
name="serviceName"
96
+
operator="stringEquals"
97
+
value=local.kms_service
98
+
}
99
+
resource_attributes {
100
+
name="accountId"
101
+
operator="stringEquals"
102
+
value=local.kms_account_id
103
+
}
104
+
resource_attributes {
105
+
name="serviceInstance"
106
+
operator="stringEquals"
107
+
value=var.existing_kms_instance_guid
108
+
}
109
+
resource_attributes {
110
+
name="resourceType"
111
+
operator="stringEquals"
112
+
value="key"
113
+
}
114
+
resource_attributes {
115
+
name="resource"
116
+
operator="stringEquals"
117
+
value=local.backup_kms_key_id
118
+
}
119
+
# Scope of policy now includes the key, so ensure to create new policy before
120
+
# destroying old one to prevent any disruption to every day services.
121
+
lifecycle {
122
+
create_before_destroy=true
123
+
}
124
+
}
125
+
126
+
# workaround for https://github.com/IBM-Cloud/terraform-provider-ibm/issues/4478
description="Allow all Elasticsearch instances in the resource group ${module.resource_group.resource_group_id} to read from the ${local.backup_kms_service_name} instance GUID ${local.existing_backup_kms_instance_guid}"
158
+
}
159
+
160
+
# workaround for https://github.com/IBM-Cloud/terraform-provider-ibm/issues/4478
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."
65
+
default=null
66
+
}
67
+
62
68
variable"region" {
63
69
type=string
64
70
description="The region where you want to deploy your instance."
@@ -208,7 +214,7 @@ variable "auto_scaling" {
208
214
209
215
variable"existing_kms_key_crn" {
210
216
type=string
211
-
description="The CRN of a Hyper Protect Crypto Services or Key Protect root key to use for disk encryption. If not specified, a root key is created in the KMS instance specified in the `existing_kms_instance_crn` input."
217
+
description="The CRN of a Hyper Protect Crypto Services or Key Protect root key to use for disk encryption. If not specified, a root key is created in the KMS instance specified in the `existing_kms_instance_crn` input. Backup encryption is only supported is some regions ([learn more](https://cloud.ibm.com/docs/cloud-databases?topic=cloud-databases-key-protect&interface=ui#key-byok)), so if you need to use a key from a different region for backup encryption, use the `existing_backup_kms_key_crn` input."
description="The CRN of a Hyper Protect Crypto Services or Key Protect instance. Required to create a new root key if no value is passed with the `existing_kms_key_crn` input. Also required to create an authorization policy if `skip_iam_authorization_policy` is false."
239
+
description="The CRN of a Hyper Protect Crypto Services or Key Protect instance. Required to create a new root key if no value is passed with the `existing_kms_key_crn` input. Also required to create an authorization policy if `skip_iam_authorization_policy` is false. Backup encryption is only supported is some regions ([learn more](https://cloud.ibm.com/docs/cloud-databases?topic=cloud-databases-key-protect&interface=ui#key-byok)), so if you need to use a different instance for backup encryption from a supported region, use the `existing_backup_kms_instance_crn` input."
description="Service credential secrets configuration for Databases for Elasticsearch. [Learn more](https://github.com/terraform-ibm-modules/terraform-ibm-elasticsearch/tree/main/solutions/instance/DA-types.md#service-credential-secrets)."
303
+
description="Service credential secrets configuration for Databases for Elasticsearch. [Learn more](https://github.com/terraform-ibm-modules/terraform-ibm-icd-elasticsearch/blob/main/solutions/standard/DA-types.md#service-credential-secrets)."
description="The CRN of an Hyper Protect Crypto Services or Key Protect encryption key that you want to use to encrypt database backups. If no value is passed, the value of `existing_kms_key_crn` is used. If no value is passed for that, a new key will be created in the provided KMS instance and used for both disk encryption, and backup encryption."
370
+
default=null
371
+
}
372
+
373
+
variable"existing_backup_kms_instance_crn" {
374
+
description="The CRN of an Hyper Protect Crypto Services or Key Protect instance that you want to use to encrypt database backups. If no value is passed, the value of the `existing_kms_instance_crn` input will be used, however backup encryption is only supported in certain regions so you need to ensure the KMS for backup is coming from one of the supported regions. [Learn more](https://cloud.ibm.com/docs/cloud-databases?topic=cloud-databases-key-protect&interface=ui#key-byok)"
0 commit comments