Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/terraform-yacloud-modules/terraform-yandex-mdb-mysql
Terraform module to manage a MySQL cluster resources within the Yandex.Cloud.
https://github.com/terraform-yacloud-modules/terraform-yandex-mdb-mysql
hacktoberfest iac mysql terraform terraform-module yandex yandex-cloud
Last synced: 6 days ago
JSON representation
Terraform module to manage a MySQL cluster resources within the Yandex.Cloud.
- Host: GitHub
- URL: https://github.com/terraform-yacloud-modules/terraform-yandex-mdb-mysql
- Owner: terraform-yacloud-modules
- License: apache-2.0
- Created: 2023-02-16T12:56:23.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-10-28T10:36:12.000Z (21 days ago)
- Last Synced: 2024-10-28T13:53:02.956Z (21 days ago)
- Topics: hacktoberfest, iac, mysql, terraform, terraform-module, yandex, yandex-cloud
- Language: HCL
- Homepage:
- Size: 82 KB
- Stars: 6
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Code of conduct: .github/CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# Yandex Cloud MySQL Terraform module
Terraform module which creates Yandex Cloud **Managed Service for MySQL** resources.
## Example
```
# Full example
module "mysql" {
source = "../../modules/mysql"
network_id = module.vpc.vpc_id
ha = true
count_ha = 3
subnet_zones = module.vpc.private_zones
subnet_id = module.vpc.private_subnets_id
assign_public_ip = false
name = "cluster-mysql"
environment = "PRESTABLE"
version_sql = "8.0"resource_preset_id = "b1.medium"
disk_type_id = "network-ssd"
disk_size = 10labels = {
created_by = "terraform_mysql_module"
}attach_security_group_ids = [module.sg_private.id]
deletion_protection = false
mysql_config = {
sql_mode = "ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION"
max_connections = 100
default_authentication_plugin = "MYSQL_NATIVE_PASSWORD"
innodb_print_all_deadlocks = true
}maintenance_window = {
type = "ANYTIME"
}backup_window_start = {
hours = 23
minutes = 59
}access = {
web_sql = true
}performance_diagnostics = {
enabled = true
sessions_sampling_interval = 30
statements_sampling_interval = 90
}}
# Minimal example
module "mysql" {
source = "../../modules/mysql"
network_id = module.vpc.vpc_id
subnet_zones = module.vpc.private_zones
name = "cluster-mysql"
}
```## Requirements
| Name | Version |
|------|---------|
| [terraform](#requirement\_terraform) | >= 1.5.0 |
| [yandex](#requirement\_yandex) | >= 0.110, < 1.0 |## Providers
| Name | Version |
|------|---------|
| [yandex](#provider\_yandex) | >= 0.110, < 1.0 |## Modules
No modules.
## Resources
| Name | Type |
|------|------|
| [yandex_mdb_mysql_cluster.mysql](https://registry.terraform.io/providers/yandex-cloud/yandex/latest/docs/resources/mdb_mysql_cluster) | resource |
| [yandex_vpc_security_group.mysql](https://registry.terraform.io/providers/yandex-cloud/yandex/latest/docs/resources/vpc_security_group) | resource |
| [yandex_client_config.client](https://registry.terraform.io/providers/yandex-cloud/yandex/latest/docs/data-sources/client_config) | data source |## Inputs
| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| [access](#input\_access) | (Optional) The access block support. If not specified then does not make any changes.
data\_lens - (Optional) Allow access for Yandex DataLens.
web\_sql - (Optional) Allows access for SQL queries in the management console.
data\_transfer - (Optional) Allow access for DataTransfer
access = {
web\_sql = true
} |object({| `null` | no |
data_lens = optional(bool)
web_sql = optional(bool)
data_transfer = optional(bool)
})
| [allow\_ingress\_v4\_cidr\_blocks](#input\_allow\_ingress\_v4\_cidr\_blocks) | (Optional) The allowed list of addresses for accessing the database on port 3306. Default `[ "0.0.0.0"/0 ]` | `list(string)` |[| no |
"0.0.0.0/0"
]
| [assign\_public\_ip](#input\_assign\_public\_ip) | (Optional) Sets whether the host should get a public IP address. It can be changed on the fly only when name is set. | `bool` | `false` | no |
| [attach\_security\_group\_ids](#input\_attach\_security\_group\_ids) | (Optional) Attach an additional security group. | `list(string)` | `null` | no |
| [backup\_retain\_period\_days](#input\_backup\_retain\_period\_days) | (Optional) The period in days during which backups are stored. | `number` | `null` | no |
| [backup\_window\_start](#input\_backup\_window\_start) | (Optional) Time to start the daily backup, in the UTC. |object({| `null` | no |
hours = optional(number)
minutes = optional(number)
})
| [count\_ha](#input\_count\_ha) | (Optional) Number of hosts in a high availability cluster | `number` | `3` | no |
| [deletion\_protection](#input\_deletion\_protection) | (Optional) Protection against cluster deletion | `bool` | `false` | no |
| [description](#input\_description) | (Optional) Description of the MySQL cluster. | `string` | `"terraform-created"` | no |
| [disk\_size](#input\_disk\_size) | (Optional) Volume of the storage available to a MySQL host, in gigabytes. Default '10'. https://yandex.cloud/ru/docs/managed-mysql/concepts/limits | `number` | `10` | no |
| [disk\_type\_id](#input\_disk\_type\_id) | (Optional) Type of the storage of MySQL hosts. Default 'network-ssd' | `string` | `"network-ssd"` | no |
| [environment](#input\_environment) | (Optional) Deployment environment of the MySQL cluster | `string` | `"PRODUCTION"` | no |
| [folder\_id](#input\_folder\_id) | https://cloud.yandex.ru/docs/resource-manager/operations/folder/get-id | `string` | `null` | no |
| [ha](#input\_ha) | (Optional) High availability cluster? | `bool` | `false` | no |
| [labels](#input\_labels) | (Optional) Set of key/value label pairs to assign. | `map(string)` |{| no |
"created_by": "terraform_mysql_module"
}
| [maintenance\_window](#input\_maintenance\_window) | (Optional) Time to start the daily backup, in the UTC. |object({|
type = optional(string)
day = optional(string)
hour = optional(number)
}){| no |
"day": null,
"hour": null,
"type": "ANYTIME"
}
| [mysql\_config](#input\_mysql\_config) | (Optional) MySQL cluster config. Detail info in https://terraform-provider.yandexcloud.net/Resources/mdb_mysql_cluster.html#mysql-config |object({| `null` | no |
sql_mode = optional(string)
max_connections = optional(number)
default_authentication_plugin = optional(string)
innodb_print_all_deadlocks = optional(bool)
})
| [name](#input\_name) | (Required) Name of the MySQL cluster. Provided by the client when the cluster is created. | `string` | `"cluster-mysql"` | no |
| [network\_id](#input\_network\_id) | (Required) ID of the network, to which the MySQL cluster belongs. | `string` | n/a | yes |
| [performance\_diagnostics](#input\_performance\_diagnostics) | (Optional) The performance\_diagnostics block supports.
enabled - Enable performance diagnostics
sessions\_sampling\_interval - Interval (in seconds) for my\_stat\_activity sampling Acceptable values are 1 to 86400, inclusive.
statements\_sampling\_interval - Interval (in seconds) for my\_stat\_statements sampling Acceptable values are 1 to 86400, inclusive.
performance\_diagnostics = {
enabled = true
sessions\_sampling\_interval = 30
statements\_sampling\_interval = 90
} |object({| `null` | no |
enabled = optional(bool)
sessions_sampling_interval = optional(number)
statements_sampling_interval = optional(number)
})
| [resource\_preset\_id](#input\_resource\_preset\_id) | (Optional) The ID of the preset for computational resources available to a MySQL host. Default 's1.micro' | `string` | `"s1.micro"` | no |
| [restore](#input\_restore) | (Optional) Time to start the daily backup, in the UTC. The structure is documented below.
backup\_id - (Required, ForceNew) Backup ID. The cluster will be created from the specified backup.
time - (Optional, ForceNew) Timestamp of the moment to which the MySQL cluster should be restored. (Format: "2006-01-02T15:04:05" - UTC). When not set, current time is used.
restore = {
backup\_id = "c9qj2tns23432471d9qha:stream\_20210122T141717Z"
time = "2021-01-23T15:04:05"
} |object({| `null` | no |
backup_id = string
time = optional(string)
})
| [subnet\_id](#input\_subnet\_id) | (Optional) The ID of the subnets, to which the host belongs. The subnet must be a part of the network to which the cluster belongs. | `list(string)` | `null` | no |
| [subnet\_zones](#input\_subnet\_zones) | (Optional) Zones name of the network, to which the MySQL cluster belongs. | `list(string)` |[| no |
"ru-central1-a"
]
| [version\_sql](#input\_version\_sql) | (Optional) Version of the MySQL cluster. Default '8.0' | `string` | `"8.0"` | no |## Outputs
| Name | Description |
|------|-------------|
| [db\_info](#output\_db\_info) | Full information about the cluster |
| [hosts\_fqdn](#output\_hosts\_fqdn) | List of server FQDN |
| [hosts\_name](#output\_hosts\_name) | List of server names |
| [id](#output\_id) | cluster ID |
| [name](#output\_name) | cluster name |