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: add support to optionally create database users (using new users variable) and admin password (using new admin_pass variable). add new outputs hostname and port which will only output if users or service credentials are created. (#200)
|[ibm_database_connection.database_connection](https://registry.terraform.io/providers/IBM-Cloud/ibm/latest/docs/data-sources/database_connection)| data source |
76
77
77
78
## Inputs
78
79
79
80
| Name | Description | Type | Default | Required |
| <aname="input_access_tags"></a> [access\_tags](#input\_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 |
83
+
| <aname="input_admin_pass"></a> [admin\_pass](#input\_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. The admin password must be in the range of 10-32 characters. |`string`|`null`| no |
82
84
| <a name="input_auto_scaling"></a> [auto\_scaling](#input\_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. | <pre>object({<br> disk = object({<br> capacity_enabled = optional(bool, false)<br> free_space_less_than_percent = optional(number, 10)<br> io_above_percent = optional(number, 90)<br> io_enabled = optional(bool, false)<br> io_over_period = optional(string, "15m")<br> rate_increase_percent = optional(number, 10)<br> rate_limit_mb_per_member = optional(number, 3670016)<br> rate_period_seconds = optional(number, 900)<br> rate_units = optional(string, "mb")<br> })<br> memory = object({<br> io_above_percent = optional(number, 90)<br> io_enabled = optional(bool, false)<br> io_over_period = optional(string, "15m")<br> rate_increase_percent = optional(number, 10)<br> rate_limit_mb_per_member = optional(number, 114688)<br> rate_period_seconds = optional(number, 900)<br> rate_units = optional(string, "mb")<br> })<br> })</pre> | `null` | no |
83
85
| <aname="input_backup_crn"></a> [backup\_crn](#input\_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 |
84
86
| <aname="input_backup_encryption_key_crn"></a> [backup\_encryption\_key\_crn](#input\_backup\_encryption\_key\_crn)| The CRN of a Key Protect key that you want to use for encrypting the disk that holds deployment backups. Only used if var.kms\_encryption\_enabled is set to true. BYOK for backups is available only in US regions us-south and us-east, and in eu-de. Only keys in the us-south and eu-de are durable to region failures. To ensure that your backups are available even if a region failure occurs, use a key from us-south or eu-de. Hyper Protect Crypto Services for IBM Cloud Databases backups is not currently supported. If no value is passed here, the value passed for the 'kms\_key\_crn' variable is used. And if a HPCS value is passed for var.kms\_key\_crn, the database backup encryption uses the default encryption keys. |`string`|`null`| no |
@@ -103,6 +105,7 @@ To attach access management tags to resources in this module, you need the follo
103
105
| <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 |
104
106
| <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 |
105
107
| <aname="input_skip_iam_authorization_policy"></a> [skip\_iam\_authorization\_policy](#input\_skip\_iam\_authorization\_policy)| Set to true to skip the creation of an IAM authorization policy that permits all PostgreSQL database instances in the resource group to read the encryption key from the KMS instance. If set to false, pass in a value for the KMS instance in the existing\_kms\_instance\_guid variable. In addition, no policy is created if var.kms\_encryption\_enabled is set to false. |`bool`|`false`| no |
108
+
| <aname="input_users"></a> [users](#input\_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| <pre>list(object({<br> name = string<br> password = string # pragma: allowlist secret<br> type = string # "type" is required to generate the connection string for the outputs.<br> role = optional(string)<br> }))</pre> |`[]`| no |
106
109
107
110
## Outputs
108
111
@@ -111,7 +114,9 @@ To attach access management tags to resources in this module, you need the follo
111
114
| <aname="output_cbr_rule_ids"></a> [cbr\_rule\_ids](#output\_cbr\_rule\_ids)| CBR rule ids created to restrict Postgresql |
| <aname="output_hostname"></a> [hostname](#output\_hostname)| Database hostname. Only contains value when var.service\_credential\_names or var.users are set. |
114
118
| <aname="output_id"></a> [id](#output\_id)| Postgresql instance id |
119
+
| <aname="output_port"></a> [port](#output\_port)| Database port. Only contains value when var.service\_credential\_names or var.users are set. |
115
120
| <aname="output_service_credentials_json"></a> [service\_credentials\_json](#output\_service\_credentials\_json)| Service credentials json map |
116
121
| <aname="output_service_credentials_object"></a> [service\_credentials\_object](#output\_service\_credentials\_object)| Service credentials object |
117
122
| <aname="output_version"></a> [version](#output\_version)| Postgresql instance version |
Copy file name to clipboardExpand all lines: examples/complete/variables.tf
+19Lines changed: 19 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -40,6 +40,25 @@ variable "pg_version" {
40
40
default=null
41
41
}
42
42
43
+
variable"admin_pass" {
44
+
type=string
45
+
default=null
46
+
sensitive=true
47
+
description="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. The admin password must be in the range of 10-32 characters."
48
+
}
49
+
50
+
variable"users" {
51
+
type=list(object({
52
+
name =string
53
+
password =string
54
+
type =string
55
+
role =optional(string)
56
+
}))
57
+
default=[]
58
+
sensitive=true
59
+
description="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."
60
+
}
61
+
43
62
variable"service_credential_names" {
44
63
description="Map of name, role for service credentials that you want to create for the database"
0 commit comments