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
*[Restore from backup example](./examples/backup-restore)
23
24
*[Contributing](#contributing)
24
25
<!-- END OVERVIEW HOOK -->
25
26
@@ -94,16 +95,16 @@ You need the following permissions to run this module.
94
95
| <aname="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 |
95
96
| <aname="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 |
96
97
| <aname="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 |
97
-
| <aname="input_endpoints"></a> [endpoints](#input\_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 |
98
-
| <aname="input_instance_name"></a> [instance\_name](#input\_instance\_name)| The name to give the Redis instance. |`string`| n/a | yes |
99
98
| <aname="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 |
100
99
| <aname="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 |
101
100
| <aname="input_members"></a> [members](#input\_members)| Allocated number of members. Members can be scaled up but not down. |`number`|`2`| no |
102
101
| <aname="input_memory_mb"></a> [memory\_mb](#input\_memory\_mb)| Allocated memory per member. [Learn more](https://cloud.ibm.com/docs/databases-for-redis?topic=databases-for-redis-resources-scaling)|`number`|`4096`| no |
102
+
| <aname="input_name"></a> [name](#input\_name)| The name to give the Redis instance. |`string`| n/a | yes |
103
103
| <aname="input_redis_version"></a> [redis\_version](#input\_redis\_version)| Version of the Redis instance to provision. If no value is passed, the current preferred version of IBM Cloud Databases is used. |`string`|`null`| no |
104
104
| <aname="input_region"></a> [region](#input\_region)| The region where you want to deploy your instance. |`string`|`"us-south"`| no |
105
105
| <aname="input_resource_group_id"></a> [resource\_group\_id](#input\_resource\_group\_id)| The resource group ID where the Redis instance will be created. |`string`| n/a | yes |
106
106
| <aname="input_service_credential_names"></a> [service\_credential\_names](#input\_service\_credential\_names)| Map of name, role for service credentials that you want to create for the database |`map(string)`|`{}`| no |
107
+
| <aname="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 |
107
108
| <aname="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 |
108
109
| <aname="input_tags"></a> [tags](#input\_tags)| Optional list of tags to be added to the Redis instance. |`list(string)`|`[]`| no |
109
110
| <aname="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 |
This example provides an end-to-end executable flow of how a Redis DB instance can be created from a backup instance. This example uses the IBM Cloud terraform provider to:
4
+
5
+
- Create a new resource group if one is not passed in.
6
+
- Create a restored ICD Redis database instance pointing to the lastest backup of the existing Redis database instance crn passed.
description="Region to provision all resources created by this example."
10
+
default="us-south"
11
+
}
12
+
13
+
variable"prefix" {
14
+
type=string
15
+
description="Prefix to append to all resources created by this example"
16
+
default="backup"
17
+
}
18
+
19
+
variable"redis_version" {
20
+
type=string
21
+
description="Version of the redis instance. If no value passed, the current ICD preferred version is used."
22
+
default=null
23
+
}
24
+
25
+
variable"resource_group" {
26
+
type=string
27
+
description="An existing resource group name to use for this example, if unset a new resource group will be created"
28
+
default=null
29
+
}
30
+
31
+
variable"resource_tags" {
32
+
type=list(string)
33
+
description="Optional list of tags to be added to created resources"
34
+
default=[]
35
+
}
36
+
37
+
variable"access_tags" {
38
+
type=list(string)
39
+
description="A list of access tags to apply to the redis instance created by the module, see https://cloud.ibm.com/docs/account?topic=account-access-tags-tutorial for more details"
40
+
default=[]
41
+
}
42
+
43
+
variable"existing_database_crn" {
44
+
type=string
45
+
description="The existing CRN of a backup resource to restore from."
# Validation (approach based on https://github.com/hashicorp/terraform/issues/25609#issuecomment-1057614400)
@@ -12,7 +15,13 @@ locals {
12
15
validate_backup_key=!var.use_ibm_owned_encryption_key&& var.backup_encryption_key_crn!=null&& (var.use_default_backup_encryption_key|| var.use_same_kms_key_for_backups) ?tobool("When passing a value for 'backup_encryption_key_crn' you cannot set 'use_default_backup_encryption_key' to true or 'use_ibm_owned_encryption_key' to false.") :true
13
16
# tflint-ignore: terraform_unused_declarations
14
17
validate_backup_key_2=!var.use_ibm_owned_encryption_key&& var.backup_encryption_key_crn==null&&!var.use_same_kms_key_for_backups?tobool("When 'use_same_kms_key_for_backups' is set to false, a value needs to be passed for 'backup_encryption_key_crn'.") :true
# If no value passed for 'backup_encryption_key_crn' use the value of 'kms_key_crn' and perform validation of 'kms_key_crn' to check if region is supported by backup encryption key.
17
26
18
27
# If 'use_ibm_owned_encryption_key' is true or 'use_default_backup_encryption_key' is true, default to null.
0 commit comments