Skip to content

Commit c2909be

Browse files
authored
feat: major in-place upgrade and deletion protection (#616)
1 parent 10ace2a commit c2909be

26 files changed

+163
-71
lines changed

.secrets.baseline

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"files": "go.sum|^.secrets.baseline$",
44
"lines": null
55
},
6-
"generated_at": "2025-02-11T19:19:45Z",
6+
"generated_at": "2025-07-17T12:58:34Z",
77
"plugins_used": [
88
{
99
"name": "AWSKeyDetector"
@@ -92,15 +92,15 @@
9292
"hashed_secret": "44cdfc3615970ada14420caaaa5c5745fca06002",
9393
"is_secret": false,
9494
"is_verified": false,
95-
"line_number": 126,
95+
"line_number": 125,
9696
"type": "Secret Keyword",
9797
"verified_result": null
9898
},
9999
{
100100
"hashed_secret": "bd0d0d73a240c29656fb8ae0dfa5f863077788dc",
101101
"is_secret": false,
102102
"is_verified": false,
103-
"line_number": 131,
103+
"line_number": 130,
104104
"type": "Secret Keyword",
105105
"verified_result": null
106106
}

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ You need the following permissions to run this module.
9494
| <a name="input_cbr_rules"></a> [cbr\_rules](#input\_cbr\_rules) | (Optional, list) List of CBR rules to create | <pre>list(object({<br/> description = string<br/> account_id = string<br/> rule_contexts = list(object({<br/> attributes = optional(list(object({<br/> name = string<br/> value = string<br/> }))) }))<br/> enforcement_mode = string<br/> tags = optional(list(object({<br/> name = string<br/> value = string<br/> })))<br/> }))</pre> | `[]` | no |
9595
| <a name="input_configuration"></a> [configuration](#input\_configuration) | Database Configuration. Default values will get picked up if not all the values are passed. | <pre>object({<br/> maxmemory = optional(number)<br/> maxmemory-policy = optional(string)<br/> appendonly = optional(string)<br/> maxmemory-samples = optional(number)<br/> stop-writes-on-bgsave-error = optional(string)<br/> })</pre> | `null` | no |
9696
| <a name="input_cpu_count"></a> [cpu\_count](#input\_cpu\_count) | Allocated dedicated CPU per member. For shared CPU, set to 0. [Learn more](https://cloud.ibm.com/docs/databases-for-redis?topic=databases-for-redis-resources-scaling) | `number` | `0` | no |
97+
| <a name="input_deletion_protection"></a> [deletion\_protection](#input\_deletion\_protection) | Enable deletion protection within terraform. This is not a property of the resource and does not prevent deletion outside of terraform. The database can not be deleted by terraform when this value is set to 'true'. In order to delete with terraform the value must be set to 'false' and a terraform apply performed before the destroy is performed. The default is 'true'. | `bool` | `true` | no |
9798
| <a name="input_disk_mb"></a> [disk\_mb](#input\_disk\_mb) | Allocated disk per member. [Learn more](https://cloud.ibm.com/docs/databases-for-redis?topic=databases-for-redis-resources-scaling) | `number` | `1024` | no |
9899
| <a name="input_kms_key_crn"></a> [kms\_key\_crn](#input\_kms\_key\_crn) | The CRN of a Key Protect or Hyper Protect Crypto Services encryption key to encrypt your data. Applies only if `use_ibm_owned_encryption_key` is false. By default this key is used for both deployment data and backups, but this behaviour can be altered using the `use_same_kms_key_for_backups` and `backup_encryption_key_crn` inputs. Bare in mind that backups encryption is only available in certain regions. See [Bring your own key for backups](https://cloud.ibm.com/docs/cloud-databases?topic=cloud-databases-key-protect&interface=ui#key-byok) and [Using the HPCS Key for Backup encryption](https://cloud.ibm.com/docs/cloud-databases?topic=cloud-databases-hpcs#use-hpcs-backups). | `string` | `null` | no |
99100
| <a name="input_member_host_flavor"></a> [member\_host\_flavor](#input\_member\_host\_flavor) | Allocated host flavor per member. [Learn more](https://registry.terraform.io/providers/IBM-Cloud/ibm/latest/docs/resources/database#host_flavor). | `string` | `null` | no |
@@ -107,10 +108,12 @@ You need the following permissions to run this module.
107108
| <a name="input_service_endpoints"></a> [service\_endpoints](#input\_service\_endpoints) | Specify whether you want to enable the public, private, or both service endpoints. Supported values are 'public', 'private', or 'public-and-private'. | `string` | `"private"` | no |
108109
| <a name="input_skip_iam_authorization_policy"></a> [skip\_iam\_authorization\_policy](#input\_skip\_iam\_authorization\_policy) | Set to true to skip the creation of IAM authorization policies that permits all Databases for Redis instances in the given resource group 'Reader' access to the Key Protect or Hyper Protect Crypto Services key that was provided in the `kms_key_crn` and `backup_encryption_key_crn` inputs. This policy is required in order to enable KMS encryption, so only skip creation if there is one already present in your account. No policy is created if `use_ibm_owned_encryption_key` is true. | `bool` | `false` | no |
109110
| <a name="input_tags"></a> [tags](#input\_tags) | Optional list of tags to be added to the Redis instance. | `list(string)` | `[]` | no |
111+
| <a name="input_timeouts_update"></a> [timeouts\_update](#input\_timeouts\_update) | A database update may require a longer timeout for the update to complete. The default is 120 minutes. Set this variable to change the `update` value in the `timeouts` block. [Learn more](https://developer.hashicorp.com/terraform/language/resources/syntax#operation-timeouts). | `string` | `"120m"` | no |
110112
| <a name="input_use_default_backup_encryption_key"></a> [use\_default\_backup\_encryption\_key](#input\_use\_default\_backup\_encryption\_key) | When `use_ibm_owned_encryption_key` is set to false, backups will be encrypted with either the key specified in `kms_key_crn`, or in `backup_encryption_key_crn` if a value is passed. If you do not want to use your own key for backups encryption, you can set this to `true` to use the IBM Cloud Databases default encryption for backups. Alternatively set `use_ibm_owned_encryption_key` to true to use the default encryption for both backups and deployment data. | `bool` | `false` | no |
111113
| <a name="input_use_ibm_owned_encryption_key"></a> [use\_ibm\_owned\_encryption\_key](#input\_use\_ibm\_owned\_encryption\_key) | IBM Cloud Databases will secure your deployment's data at rest automatically with an encryption key that IBM hold. Alternatively, you may select your own Key Management System instance and encryption key (Key Protect or Hyper Protect Crypto Services) by setting this to false. If setting to false, a value must be passed for the `kms_key_crn` input. | `bool` | `true` | no |
112114
| <a name="input_use_same_kms_key_for_backups"></a> [use\_same\_kms\_key\_for\_backups](#input\_use\_same\_kms\_key\_for\_backups) | Set this to false if you wan't to use a different key that you own to encrypt backups. When set to false, a value is required for the `backup_encryption_key_crn` input. Alternatiely set `use_default_backup_encryption_key` to true to use the IBM Cloud Databases default encryption. Applies only if `use_ibm_owned_encryption_key` is false. Bare in mind that backups encryption is only available in certain regions. See [Bring your own key for backups](https://cloud.ibm.com/docs/cloud-databases?topic=cloud-databases-key-protect&interface=ui#key-byok) and [Using the HPCS Key for Backup encryption](https://cloud.ibm.com/docs/cloud-databases?topic=cloud-databases-hpcs#use-hpcs-backups). | `bool` | `true` | no |
113115
| <a name="input_users"></a> [users](#input\_users) | A list of users that you want to create on the database. Users block is supported by Redis version >= 6.0. Multiple blocks are allowed. The user password must be in the range of 10-32 characters. Be warned that in most case using IAM service credentials (via the var.service\_credential\_names) is sufficient to control access to the Redis instance. This blocks creates native redis database users, more info on that can be found here https://cloud.ibm.com/docs/databases-for-redis?topic=databases-for-redis-user-management&interface=ui | <pre>list(object({<br/> name = string<br/> password = string # pragma: allowlist secret<br/> type = optional(string)<br/> role = optional(string)<br/> }))</pre> | `[]` | no |
116+
| <a name="input_version_upgrade_skip_backup"></a> [version\_upgrade\_skip\_backup](#input\_version\_upgrade\_skip\_backup) | Whether to skip taking a backup before upgrading the database version. Attention: Skipping a backup is not recommended. Skipping a backup before a version upgrade is dangerous and may result in data loss if the upgrade fails at any stage — there will be no immediate backup to restore from. | `bool` | `false` | no |
114117

115118
### Outputs
116119

examples/backup-restore/catalogValidationValues.json.template

Lines changed: 0 additions & 6 deletions
This file was deleted.

examples/backup-restore/main.tf

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,13 @@ module "restored_icd_redis" {
2020
# remove the above line and uncomment the below 2 lines to consume the module from the registry
2121
# source = "terraform-ibm-modules/icd-redis/ibm"
2222
# version = "X.Y.Z" # Replace "X.Y.Z" with a release version to lock into a specific release
23-
resource_group_id = module.resource_group.resource_group_id
24-
name = "${var.prefix}-redis-restored"
25-
redis_version = var.redis_version
26-
region = var.region
27-
tags = var.resource_tags
28-
access_tags = var.access_tags
29-
member_host_flavor = "multitenant"
30-
backup_crn = data.ibm_database_backups.backup_database.backups[0].backup_id
23+
resource_group_id = module.resource_group.resource_group_id
24+
name = "${var.prefix}-redis-restored"
25+
redis_version = var.redis_version
26+
region = var.region
27+
tags = var.resource_tags
28+
access_tags = var.access_tags
29+
member_host_flavor = "multitenant"
30+
deletion_protection = false
31+
backup_crn = data.ibm_database_backups.backup_database.backups[0].backup_id
3132
}

examples/basic/catalogValidationValues.json.template

Lines changed: 0 additions & 6 deletions
This file was deleted.

examples/basic/main.tf

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,15 @@ module "database" {
1919
# remove the above line and uncomment the below 2 lines to consume the module from the registry
2020
# source = "terraform-ibm-modules/icd-redis/ibm"
2121
# version = "X.Y.Z" # Replace "X.Y.Z" with a release version to lock into a specific release
22-
resource_group_id = module.resource_group.resource_group_id
23-
name = "${var.prefix}-data-store"
24-
region = var.region
25-
access_tags = var.access_tags
26-
service_endpoints = var.service_endpoints
27-
member_host_flavor = var.member_host_flavor
28-
tags = var.resource_tags
29-
redis_version = var.redis_version
22+
resource_group_id = module.resource_group.resource_group_id
23+
name = "${var.prefix}-data-store"
24+
region = var.region
25+
redis_version = var.redis_version
26+
access_tags = var.access_tags
27+
tags = var.resource_tags
28+
service_endpoints = var.service_endpoints
29+
member_host_flavor = var.member_host_flavor
30+
deletion_protection = false
3031
service_credential_names = {
3132
"redis_admin" : "Administrator",
3233
"redis_operator" : "Operator",

examples/basic/variables.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ variable "resource_tags" {
3535
}
3636

3737
variable "redis_version" {
38-
description = "Version of the Redis instance to provision. If no value is passed, the current preferred version of IBM Cloud Databases is used."
3938
type = string
39+
description = "Version of the Redis instance to provision. If no value is passed, the current preferred version of IBM Cloud Databases is used."
4040
default = null
4141
}
4242

examples/complete/catalogValidationValues.json.template

Lines changed: 0 additions & 6 deletions
This file was deleted.

examples/complete/main.tf

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,9 @@ module "icd_redis" {
110110
"redis_viewer" : "Viewer",
111111
"redis_editor" : "Editor",
112112
}
113-
access_tags = var.access_tags
114-
member_host_flavor = "multitenant"
113+
access_tags = var.access_tags
114+
member_host_flavor = "multitenant"
115+
deletion_protection = false
115116
cbr_rules = [
116117
{
117118
description = "sample rule"

examples/fscloud/catalogValidationValues.json.template

Lines changed: 0 additions & 7 deletions
This file was deleted.

0 commit comments

Comments
 (0)