- 
                Notifications
    You must be signed in to change notification settings 
- Fork 2
feat: add support to use a different KMS key for backup encryption #511
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 4 commits
5554535
              e1f09e1
              8f6e9b6
              275c209
              a475c71
              51dad9c
              0007363
              f37bd49
              9920a2f
              5af863b
              6e3550d
              5e74750
              4bb7756
              f426504
              f2db8e6
              a987965
              File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -1,27 +1,28 @@ | ||
| module "postgresql_db" { | ||
| source = "../../" | ||
| resource_group_id = var.resource_group_id | ||
| name = var.name | ||
| region = var.region | ||
| skip_iam_authorization_policy = var.skip_iam_authorization_policy | ||
| service_endpoints = "private" | ||
| pg_version = var.pg_version | ||
| kms_encryption_enabled = true | ||
| existing_kms_instance_guid = var.existing_kms_instance_guid | ||
| kms_key_crn = var.kms_key_crn | ||
| backup_encryption_key_crn = var.backup_encryption_key_crn | ||
| resource_tags = var.resource_tags | ||
| access_tags = var.access_tags | ||
| cbr_rules = var.cbr_rules | ||
| configuration = var.configuration | ||
| member_memory_mb = var.member_memory_mb | ||
| member_disk_mb = var.member_disk_mb | ||
| member_cpu_count = var.member_cpu_count | ||
| member_host_flavor = var.member_host_flavor | ||
| members = var.members | ||
| admin_pass = var.admin_pass | ||
| users = var.users | ||
| service_credential_names = var.service_credential_names | ||
| auto_scaling = var.auto_scaling | ||
| backup_crn = var.backup_crn | ||
| source = "../../" | ||
| resource_group_id = var.resource_group_id | ||
| name = var.name | ||
| region = var.region | ||
| skip_iam_authorization_policy = var.skip_iam_authorization_policy | ||
| service_endpoints = "private" | ||
| pg_version = var.pg_version | ||
| kms_encryption_enabled = true | ||
| existing_kms_instance_guid = var.existing_kms_instance_guid | ||
| kms_key_crn = var.kms_key_crn | ||
| backup_encryption_key_crn = var.backup_encryption_key_crn | ||
| resource_tags = var.resource_tags | ||
| access_tags = var.access_tags | ||
| cbr_rules = var.cbr_rules | ||
| configuration = var.configuration | ||
| member_memory_mb = var.member_memory_mb | ||
| member_disk_mb = var.member_disk_mb | ||
| member_cpu_count = var.member_cpu_count | ||
| member_host_flavor = var.member_host_flavor | ||
| members = var.members | ||
| admin_pass = var.admin_pass | ||
| users = var.users | ||
| service_credential_names = var.service_credential_names | ||
| auto_scaling = var.auto_scaling | ||
| backup_crn = var.backup_crn | ||
| use_default_backup_encryption_key = var.use_default_backup_encryption_key | ||
| } | 
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
|  | @@ -15,6 +15,13 @@ variable "ibmcloud_kms_api_key" { | |
| default = null | ||
| } | ||
|  | ||
| variable "ibmcloud_backup_kms_api_key" { | ||
|         
                  Aashiq-J marked this conversation as resolved.
              Outdated
          
            Show resolved
            Hide resolved | ||
| type = string | ||
| description = "The IBM Cloud API key that can create a root key and key ring in the key management service (KMS) instance. If not specified, the 'ibmcloud_api_key' variable is used. Specify this key if the instance in `existing_kms_instance_crn` is in an account that's different from the PostgreSQL instance. Leave this input empty if the same account owns both instances." | ||
| sensitive = true | ||
| default = null | ||
| } | ||
|  | ||
| variable "use_existing_resource_group" { | ||
| type = bool | ||
| description = "Whether to use an existing resource group." | ||
|  | @@ -50,6 +57,12 @@ variable "pg_version" { | |
| default = null | ||
| } | ||
|  | ||
| variable "backup_crn" { | ||
| type = string | ||
| 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." | ||
| default = null | ||
| } | ||
|  | ||
| ############################################################################## | ||
| # ICD hosting model properties | ||
| ############################################################################## | ||
|  | @@ -159,7 +172,7 @@ variable "configuration" { | |
| tcp_keepalives_interval = 15 | ||
| tcp_keepalives_count = 6 | ||
| archive_timeout = 1800 | ||
| wal_level = "replica" | ||
| wal_level = "logical" | ||
|          | ||
| max_replication_slots = 10 | ||
| max_wal_senders = 12 | ||
| } | ||
|  | @@ -237,3 +250,52 @@ variable "skip_iam_authorization_policy" { | |
| description = "Whether to create an IAM authorization policy that permits all PostgreSQL instances in the resource group to read the encryption key from the Hyper Protect Crypto Services instance specified in the `existing_kms_instance_crn` variable." | ||
| default = false | ||
| } | ||
|  | ||
| ############################################################## | ||
| # Backup Encryption | ||
| ############################################################## | ||
| variable "backup_key_name" { | ||
| type = string | ||
| default = "postgresql-backup-key" | ||
| description = "The name for the key created for the PostgreSQL key. Applies only if not specifying an existing key. If a prefix input variable is specified, the prefix is added to the name in the `<prefix>-<name>` format." | ||
| } | ||
|  | ||
| variable "backup_key_ring_name" { | ||
| type = string | ||
| default = "postgresql-backup-key-ring" | ||
| description = "The name for the key ring created for the PostgreSQL key. Applies only if not specifying an existing key. If a prefix input variable is specified, the prefix is added to the name in the `<prefix>-<name>` format." | ||
| } | ||
|         
                  Aashiq-J marked this conversation as resolved.
              Outdated
          
            Show resolved
            Hide resolved | ||
|  | ||
| variable "backup_kms_endpoint_type" { | ||
|         
                  Aashiq-J marked this conversation as resolved.
              Outdated
          
            Show resolved
            Hide resolved | ||
| type = string | ||
| description = "The type of endpoint to use for communicating with the Key Protect or Hyper Protect Crypto Services instance. Possible values: `public`, `private`." | ||
| default = "private" | ||
| validation { | ||
| condition = can(regex("public|private", var.backup_kms_endpoint_type)) | ||
| error_message = "The backup_kms_endpoint_type value must be 'public' or 'private'." | ||
| } | ||
| } | ||
|  | ||
| variable "existing_backup_kms_key_crn" { | ||
| type = string | ||
| 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." | ||
|          | ||
| default = null | ||
| } | ||
|  | ||
| variable "existing_backup_kms_instance_crn" { | ||
| description = "The CRN of a Hyper Protect Crypto Services or Key Protect instance in the same account as the PostgreSQL instance. This value is used to create an authorization policy if `skip_iam_authorization_policy` is false. If not specified, a root key is created." | ||
|          | ||
| type = string | ||
| default = null | ||
| } | ||
|  | ||
| variable "skip_backup_kms_iam_authorization_policy" { | ||
|         
                  Aashiq-J marked this conversation as resolved.
              Outdated
          
            Show resolved
            Hide resolved | ||
| type = bool | ||
| description = "Whether to create an IAM authorization policy that permits all PostgreSQL instances in the resource group to read the encryption key from the Hyper Protect Crypto Services instance specified in the `existing_kms_instance_crn` variable." | ||
| default = false | ||
| } | ||
|  | ||
| variable "use_default_backup_encryption_key" { | ||
|         
                  Aashiq-J marked this conversation as resolved.
              Outdated
          
            Show resolved
            Hide resolved | ||
| type = bool | ||
| description = "Set to true to use default ICD randomly generated keys." | ||
| default = false | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.