An open API service indexing awesome lists of open source software.

https://github.com/terraform-yacloud-modules/terraform-yandex-mdb-postgresql

Terraform module to manage PostgreSQL resources within the Yandex.Cloud.
https://github.com/terraform-yacloud-modules/terraform-yandex-mdb-postgresql

hacktoberfest yandex yandex-cloud

Last synced: 7 months ago
JSON representation

Terraform module to manage PostgreSQL resources within the Yandex.Cloud.

Awesome Lists containing this project

README

          

# Yandex Cloud PostgreSQL Terraform module

Terraform module which creates Yandex Cloud PostgreSQL resources.

## Examples

Examples codified under
the [`examples`](https://github.com/terraform-yacloud-modules/terraform-yandex-module-template/tree/main/examples) are intended
to give users references for how to use the module(s) as well as testing/validating changes to the source code of the
module. If contributing to the project, please be sure to make any appropriate updates to the relevant examples to allow
maintainers to test your changes and to keep the examples up to date for users. Thank you!

## Requirements

| Name | Version |
|------|---------|
| [terraform](#requirement\_terraform) | >= 1.3 |
| [yandex](#requirement\_yandex) | >= 0.72.0 |

## Providers

| Name | Version |
|------|---------|
| [random](#provider\_random) | n/a |
| [yandex](#provider\_yandex) | >= 0.72.0 |

## Modules

No modules.

## Resources

| Name | Type |
|------|------|
| [random_password.password](https://registry.terraform.io/providers/hashicorp/random/latest/docs/resources/password) | resource |
| [yandex_mdb_postgresql_cluster.main](https://registry.terraform.io/providers/yandex-cloud/yandex/latest/docs/resources/mdb_postgresql_cluster) | resource |
| [yandex_mdb_postgresql_database.database](https://registry.terraform.io/providers/yandex-cloud/yandex/latest/docs/resources/mdb_postgresql_database) | resource |
| [yandex_mdb_postgresql_user.owner](https://registry.terraform.io/providers/yandex-cloud/yandex/latest/docs/resources/mdb_postgresql_user) | resource |
| [yandex_mdb_postgresql_user.user](https://registry.terraform.io/providers/yandex-cloud/yandex/latest/docs/resources/mdb_postgresql_user) | resource |

## Inputs

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| [access](#input\_access) | Access policy to the PostgreSQL cluster |

object({
data_lens = optional(bool)
web_sql = optional(bool)
serverless = optional(bool)
data_transfer = optional(bool)
})
| `null` | no |
| [autofailover](#input\_autofailover) | Configuration setting which enables/disables autofailover in cluster | `bool` | `true` | no |
| [backup\_retain\_period\_days](#input\_backup\_retain\_period\_days) | The period in days during which backups are stored | `number` | `7` | no |
| [backup\_window\_start](#input\_backup\_window\_start) | Time to start the daily backup, in the UTC timezone |
object({
hours = optional(number)
minutes = optional(number)
})
| `null` | no |
| [databases](#input\_databases) | List of PostgreSQL databases.

Values:
- name - (Required) The name of the database.
- owner - (Required) Name of the user assigned as the owner of the database. Forbidden to change in an existing database.
- extension - (Optional) Set of database extensions.
- lc\_collate - (Optional) POSIX locale for string sorting order. Forbidden to change in an existing database.
- lc\_type - (Optional) POSIX locale for character classification. Forbidden to change in an existing database.
- template\_db - (Optional) Name of the template database.
- deletion\_protection - (Optional) A deletion protection. |
list(object({
name = string
owner = string
lc_collate = optional(string, null)
lc_type = optional(string, null)
template_db = optional(string, null)
deletion_protection = optional(bool, null)
extensions = optional(list(string), [])
}))
| n/a | yes |
| [default\_user\_settings](#input\_default\_user\_settings) | The default user settings. These settings are overridden by the user's settings.
Full description https://cloud.yandex.com/en-ru/docs/managed-postgresql/api-ref/grpc/user_service#UserSettings1 | `map(any)` | `{}` | no |
| [deletion\_protection](#input\_deletion\_protection) | Inhibits deletion of the cluster | `bool` | `false` | no |
| [description](#input\_description) | Description of the PostgreSQL cluster | `string` | `null` | no |
| [disk\_size](#input\_disk\_size) | Volume of the storage available to a PostgreSQL host, in gigabytes | `number` | n/a | yes |
| [disk\_size\_autoscaling](#input\_disk\_size\_autoscaling) | Cluster disk size autoscaling settings |
object({
disk_size_limit = number
planned_usage_threshold = number
emergency_usage_threshold = number
})
| `null` | no |
| [disk\_type\_id](#input\_disk\_type\_id) | Type of the storage of PostgreSQL hosts | `string` | n/a | yes |
| [environment](#input\_environment) | Environment type: PRODUCTION or PRESTABLE | `string` | `"PRODUCTION"` | no |
| [folder\_id](#input\_folder\_id) | ID of the folder that the resource belongs to | `string` | `null` | no |
| [hosts](#input\_hosts) | A list of hosts in the PostgreSQL cluster |
list(object({
zone = string
subnet_id = string
assign_public_ip = bool
name = optional(string)
priority = optional(number)
replication_source_name = optional(string)
}))
| n/a | yes |
| [labels](#input\_labels) | A set of key/value label pairs to assign to the PostgreSQL cluster | `map(string)` | `{}` | no |
| [maintenance\_window](#input\_maintenance\_window) | Maintenance policy of the PostgreSQL cluster |
object({
type = string
day = optional(string, null)
hour = optional(number, null)
})
|
{
"type": "ANYTIME"
}
| no |
| [name](#input\_name) | Name of the PostgreSQL cluster | `string` | n/a | yes |
| [network\_id](#input\_network\_id) | ID of the network to which the PostgreSQL cluster belongs | `string` | n/a | yes |
| [owners](#input\_owners) | List of special PostgreSQL DB users - database owners. These users are created first and assigned to database as owner.
There is also an additional list for other users with own permissions.

Values:
- name - (Required) The name of the user.
- password - (Optional) The user's password. If it's omitted a random password will be generated.
- grants - (Optional) List of the user's grants.
- login - (Optional) The user's ability to login.
- conn\_limit - (Optional) The maximum number of connections per user.
- settings - (Optional) A user setting options.
- deletion\_protection - (Optional) A deletion protection. |
list(object({
name = string
password = optional(string, null)
grants = optional(list(string), [])
login = optional(bool, true)
conn_limit = optional(number, 50)
settings = optional(map(any), {})
deletion_protection = optional(bool, false)
}))
| n/a | yes |
| [performance\_diagnostics](#input\_performance\_diagnostics) | Cluster performance diagnostics settings |
object({
enabled = optional(bool)
sessions_sampling_interval = optional(number)
statements_sampling_interval = optional(number)
})
| `null` | no |
| [pooler\_config](#input\_pooler\_config) | Configuration of the connection pooler |
object({
pool_discard = optional(bool)
pooling_mode = optional(string)
})
| `null` | no |
| [postgresql\_config](#input\_postgresql\_config) | PostgreSQL cluster config | `map(string)` | `{}` | no |
| [postgresql\_version](#input\_postgresql\_version) | Version of the PostgreSQL cluster | `string` | n/a | yes |
| [resource\_preset\_id](#input\_resource\_preset\_id) | The ID of the preset for computational resources available to a PostgreSQL host | `string` | n/a | yes |
| [restore](#input\_restore) | The cluster will be created from the specified backup |
object({
backup_id = string
time = optional(string)
time_inclusive = optional(bool)
})
| `null` | no |
| [security\_group\_ids](#input\_security\_group\_ids) | A set of IDs of security groups assigned to hosts of the cluster | `list(string)` | `[]` | no |
| [users](#input\_users) | List of additional PostgreSQL users with own permissions. They are created at the end.

Required values:
- name - (Required) The name of the user.
- password - (Optional) The user's password. If it's omitted a random password will be generated.
- grants - (Optional) List of the user's grants.
- login - (Optional) The user's ability to login.
- conn\_limit - (Optional) The maximum number of connections per user.
- permissions - (Optional) List of databases names for an access
- settings - (Optional) A user setting options.
- deletion\_protection - (Optional) A deletion protection. |
list(object({
name = string
password = optional(string, null)
grants = optional(list(string), [])
login = optional(bool, null)
conn_limit = optional(number, null)
permissions = optional(list(string), [])
settings = optional(map(any), {})
deletion_protection = optional(bool, null)
}))
| `[]` | no |

## Outputs

| Name | Description |
|------|-------------|
| [cluster\_fqdns\_list](#output\_cluster\_fqdns\_list) | PostgreSQL cluster nodes FQDN list |
| [cluster\_host\_names\_list](#output\_cluster\_host\_names\_list) | PostgreSQL cluster host name |
| [cluster\_id](#output\_cluster\_id) | PostgreSQL cluster ID |
| [cluster\_name](#output\_cluster\_name) | PostgreSQL cluster name |
| [config](#output\_config) | Configuration of the PostgreSQL cluster |
| [databases](#output\_databases) | List of databases names |
| [deletion\_protection](#output\_deletion\_protection) | Inhibits deletion of the cluster |
| [description](#output\_description) | Description of the PostgreSQL cluster |
| [environment](#output\_environment) | Deployment environment of the PostgreSQL cluster |
| [folder\_id](#output\_folder\_id) | ID of the folder that the resource belongs to |
| [hosts](#output\_hosts) | A list of hosts in the PostgreSQL cluster |
| [labels](#output\_labels) | A set of key/value label pairs to assign to the PostgreSQL cluster |
| [maintenance\_window](#output\_maintenance\_window) | Maintenance policy of the PostgreSQL cluster |
| [name](#output\_name) | Name of the PostgreSQL cluster |
| [network\_id](#output\_network\_id) | ID of the network to which the PostgreSQL cluster belongs |
| [owners\_data](#output\_owners\_data) | List of owners with passwords |
| [security\_group\_ids](#output\_security\_group\_ids) | A set of IDs of security groups assigned to hosts of the cluster |
| [users\_data](#output\_users\_data) | List of users with passwords |

## License

Apache-2.0 Licensed.
See [LICENSE](https://github.com/terraform-yacloud-modules/terraform-yandex-module-template/blob/main/LICENSE).