Skip to content

Latest commit

 

History

History
78 lines (65 loc) · 17.9 KB

File metadata and controls

78 lines (65 loc) · 17.9 KB

Profile for IBM Cloud Framework for Financial Services

This code is a version of the parent root module that includes a default configuration that complies with the relevant controls from the IBM Cloud Framework for Financial Services. See the Example for IBM Cloud Framework for Financial Services for logic that uses this module. The Databases for PostgreSQL service as well as the infrastructure that is deployed by this module is validated with the Framework for Financial Services. For more information, see the list of Financial Services Validated services.

The default values in this profile were scanned by IBM Code Risk Analyzer (CRA) for compliance with the IBM Cloud Framework for Financial Services profile that is specified by the IBM Security and Compliance Center.

The IBM Cloud Framework for Financial Services mandates the application of an inbound network-based allowlist in front of the IBM Cloud Databases for (ICD) PostgreSQL instance. You can comply with this requirement by using the cbr_rules variable in the module, which can be used to create a narrow context-based restriction rule that is scoped to the PostgreSQL instance.

Requirements

Name Version
terraform >= 1.9.0
ibm >=1.87.3, <2.0.0

Modules

Name Source Version
postgresql_db ../../ n/a

Resources

No resources.

Inputs

Name Description Type Default Required
access_tags A list of access tags to apply to the PostgreSQL instance created by the module, see https://cloud.ibm.com/docs/account?topic=account-access-tags-tutorial for more details list(string) [] no
admin_pass The password for the database administrator. If the admin password is null then the admin user ID cannot be accessed. More users can be specified in a user block. string null no
async_restore Set it to true, to initiate the restore as an asynchronous operation, which helps to reduce end-to-end restore time. This feature can only be used when the source and target PostgreSQL databases are running the same major version. bool false no
auto_scaling 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.
object({
disk = object({
capacity_enabled = optional(bool, false)
free_space_less_than_percent = optional(number, 10)
io_above_percent = optional(number, 90)
io_enabled = optional(bool, false)
io_over_period = optional(string, "15m")
rate_increase_percent = optional(number, 10)
rate_limit_mb_per_member = optional(number, 3670016)
rate_period_seconds = optional(number, 900)
rate_units = optional(string, "mb")
})
memory = object({
io_above_percent = optional(number, 90)
io_enabled = optional(bool, false)
io_over_period = optional(string, "15m")
rate_increase_percent = optional(number, 10)
rate_limit_mb_per_member = optional(number, 114688)
rate_period_seconds = optional(number, 900)
rate_units = optional(string, "mb")
})
})
null no
backup_crn 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. string null no
backup_encryption_key_crn The CRN of a Key Protect or Hyper Protect Crypto Services encryption key that you want to use for encrypting the disk that holds deployment backups. Applies only if use_ibm_owned_encryption_key is false and use_same_kms_key_for_backups is false. If no value is passed, and use_same_kms_key_for_backups is true, the value of kms_key_crn is used. Alternatively set use_default_backup_encryption_key to true to use the IBM Cloud Databases default encryption. Bare in mind that backups encryption is only available in certain regions. See Bring your own key for backups and Using the HPCS Key for Backup encryption. string null no
cbr_rules (Optional, list) List of CBR rules to create
list(object({
description = string
account_id = string
rule_contexts = list(object({
attributes = optional(list(object({
name = string
value = string
}))) }))
enforcement_mode = string
tags = optional(list(object({
name = string
value = string
})))
operations = optional(list(object({
api_types = list(object({
api_type_id = string
}))
})))
}))
[] no
configuration Database configuration parameters, see https://cloud.ibm.com/docs/databases-for-postgresql?topic=databases-for-postgresql-changing-configuration&interface=api for more details.
object({
shared_buffers = optional(number)
max_connections = optional(number)
# below field gives error when sent to provider
# tracking issue: IBM-Cloud/terraform-provider-ibm#5403
# max_locks_per_transaction = optional(number)
max_prepared_transactions = optional(number)
synchronous_commit = optional(string)
effective_io_concurrency = optional(number)
deadlock_timeout = optional(number)
log_connections = optional(string)
log_disconnections = optional(string)
log_min_duration_statement = optional(number)
tcp_keepalives_idle = optional(number)
tcp_keepalives_interval = optional(number)
tcp_keepalives_count = optional(number)
archive_timeout = optional(number)
wal_level = optional(string)
max_replication_slots = optional(number)
max_wal_senders = optional(number)
})
null no
create_timeout A database creation may require a longer timeout for the creation to complete. The default is 120 minutes. Set this variable to change the create value in the timeouts block. Learn more. string "120m" no
delete_timeout A database deletion may require a longer timeout for the deletion to complete. The default is 15 minutes. Set this variable to change the delete value in the timeouts block. Learn more. string "15m" no
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
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 and Using the HPCS Key for Backup encryption. string null no
member_cpu_count Allocated dedicated CPU per member. For shared CPU, set to 0. Learn more number 3 no
member_disk_mb Allocated disk per member. Learn more number 5120 no
member_host_flavor Allocated host flavor per member. Learn more string null no
member_memory_mb Allocated memory per member. Learn more number 4096 no
members Allocated number of members. Members can be scaled up but not down. number 2 no
name The name to give the Postgresql instance. string n/a yes
postgresql_version Version of the PostgreSQL instance. If no value is passed, the current preferred version of IBM Cloud Databases is used. string null no
region The region where you want to deploy your instance. Must be the same region as the Hyper Protect Crypto Services instance. string "us-south" no
remote_leader_crn A CRN of the leader database to make the replica(read-only) deployment. The leader database is created by a database deployment with the same service ID. A read-only replica is set up to replicate all of your data from the leader deployment to the replica deployment by using asynchronous replication. For more information, see https://cloud.ibm.com/docs/databases-for-postgresql?topic=databases-for-postgresql-read-only-replicas string null no
resource_group_id The resource group ID where the PostgreSQL instance will be created. string n/a yes
service_credential_names A list of service credential resource keys to be created for the PostgreSQL instance.
list(object({
name = string
role = optional(string, "Viewer")
endpoint = optional(string, "private")
}))
[] no
skip_iam_authorization_policy Set to true to skip the creation of IAM authorization policies that permits all Databases for PostgreSQL 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
tags Optional list of tags to be added to the PostgreSQL instance. list(string) [] no
update_timeout 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. string "120m" no
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
use_ibm_owned_encryption_key Set to true to use the default IBM Cloud® Databases randomly generated keys for disk and backups encryption. To control the encryption keys, use the kms_key_crn and backup_encryption_key_crn inputs. string false no
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. Alternatively 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 and Using the HPCS Key for Backup encryption. bool true no
users 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. Be warned that in most case using IAM service credentials (via the var.service_credential_names) is sufficient to control access to the Postgres instance. This blocks creates native postgres database users, more info on that can be found here https://cloud.ibm.com/docs/databases-for-postgresql?topic=databases-for-postgresql-user-management&interface=ui
list(object({
name = string
password = string # pragma: allowlist secret
type = optional(string)
role = optional(string)
}))
[] no
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

Outputs

Name Description
adminuser Database admin user name
cbr_rule_ids CBR rule ids created to restrict Postgresql
certificate_base64 Database connection certificate
crn Postgresql instance crn
guid Postgresql instance guid
hostname Database connection hostname
id Postgresql instance id
port Database connection port
service_credentials_json Service credentials json map
service_credentials_object Service credentials object
version Postgresql instance version