diff --git a/README.md b/README.md index fa1a7e4..72acb19 100644 --- a/README.md +++ b/README.md @@ -5,19 +5,27 @@ ### [SquareOps Technologies](https://squareops.com/) Your DevOps Partner for Accelerating cloud journey.
+This module allows you to easily deploy a MySQL database on Kubernetes using Helm. It provides flexible configuration options for the MySQL database, including storage class, database volume sizes, and architecture. In addition, it supports enabling backups and restoring from backups, as well as deploying MySQL database exporters to gather metrics for Grafana. This module is designed to be highly configurable and customizable, and can be easily integrated into your existing Terraform infrastructure code. + +## Supported Versions: + +| MysqlDB Helm Chart Version | K8s supported version | +| :-----: | :--- | +| **9.2.0** | **1.23,1.24,1.25** | + ## Usage Example ```hcl module "mysql" { - source = "../.." - cluster_name = "dev-skaf" + source = "https://github.com/sq-ia/terraform-kubernetes-mysql.git" + cluster_name = "dev-cluster" mysqldb_config = { name = "skaf" values_yaml = "" environment = "prod" architecture = "replication" - storage_class_name = "infra-service-sc" + storage_class_name = "gp2" custom_user_username = "admin" primary_db_volume_size = "10Gi" secondary_db_volume_size = "10Gi" @@ -25,9 +33,14 @@ module "mysql" { } mysqldb_backup_enabled = true mysqldb_backup_config = { - s3_bucket_uri = "s3://bucket-name" - s3_bucket_region = "bucket-region" - cron_for_full_backup = "*/2 * * * *" + s3_bucket_uri = "" + s3_bucket_region = "" + cron_for_full_backup = "* * * * *" + } + mysqldb_restore_enabled = true + mysqldb_restore_config = { + s3_bucket_uri = "" + s3_bucket_region = "" } mysqldb_exporter_enabled = true } @@ -89,24 +102,24 @@ No modules. | Name | Description | Type | Default | Required | |------|-------------|------|---------|:--------:| -| [app\_version](#input\_app\_version) | App version | `string` | `"8.0.29-debian-11-r9"` | no | -| [chart\_version](#input\_chart\_version) | Chart version | `string` | `"9.2.0"` | no | -| [cluster\_name](#input\_cluster\_name) | Name of the EKS cluster | `string` | `""` | no | -| [create\_namespace](#input\_create\_namespace) | Set it to true to create given namespace | `string` | `true` | no | -| [mysqldb\_backup\_config](#input\_mysqldb\_backup\_config) | Mysql Backup configurations | `any` |
{
"cron_for_full_backup": "",
"s3_bucket_region": "",
"s3_bucket_uri": ""
}
| no | -| [mysqldb\_backup\_enabled](#input\_mysqldb\_backup\_enabled) | Set true to enable mysql backups | `bool` | `false` | no | -| [mysqldb\_config](#input\_mysqldb\_config) | Mysql configurations | `any` |
{
"architecture": "",
"custom_user_username": "",
"environment": "",
"name": "",
"primary_db_volume_size": "",
"secondary_db_replica_count": 1,
"secondary_db_volume_size": "",
"storage_class_name": "",
"values_yaml": ""
}
| no | -| [mysqldb\_exporter\_enabled](#input\_mysqldb\_exporter\_enabled) | Set true to deploy mysqldb exporters to get metrics in grafana | `bool` | `false` | no | -| [mysqldb\_restore\_config](#input\_mysqldb\_restore\_config) | Mysql Restore configurations | `any` |
{
"s3_bucket_region": "",
"s3_bucket_uri": ""
}
| no | -| [mysqldb\_restore\_enabled](#input\_mysqldb\_restore\_enabled) | Set true to enable mysql restore | `bool` | `false` | no | -| [namespace](#input\_namespace) | Namespace name | `string` | `"mysqldb"` | no | -| [recovery\_window\_aws\_secret](#input\_recovery\_window\_aws\_secret) | Number of days that AWS Secrets Manager waits before it can delete the secret. This value can be 0 to force deletion without recovery or range from 7 to 30 days. | `number` | `0` | no | +| [app\_version](#input\_app\_version) | Version of the MySQL application that will be deployed. | `string` | `"8.0.29-debian-11-r9"` | no | +| [chart\_version](#input\_chart\_version) | Version of the Mysql chart that will be used to deploy MySQL application. | `string` | `"9.2.0"` | no | +| [cluster\_name](#input\_cluster\_name) | Specifies the name of the EKS cluster to deploy the MySQL application on. | `string` | `""` | no | +| [create\_namespace](#input\_create\_namespace) | Specify whether or not to create the namespace if it does not already exist. Set it to true to create the namespace. | `string` | `true` | no | +| [mysqldb\_backup\_config](#input\_mysqldb\_backup\_config) | configuration options for MySQL database backups. It includes properties such as the S3 bucket URI, the S3 bucket region, and the cron expression for full backups. | `any` |
{
"cron_for_full_backup": "",
"s3_bucket_region": "",
"s3_bucket_uri": ""
}
| no | +| [mysqldb\_backup\_enabled](#input\_mysqldb\_backup\_enabled) | Specifies whether to enable backups for MySQL database. | `bool` | `false` | no | +| [mysqldb\_config](#input\_mysqldb\_config) | Specify the configuration settings for MySQL, including the name, environment, storage options, replication settings, and custom YAML values. | `any` |
{
"architecture": "",
"custom_user_username": "",
"environment": "",
"name": "",
"primary_db_volume_size": "",
"secondary_db_replica_count": 1,
"secondary_db_volume_size": "",
"storage_class_name": "",
"values_yaml": ""
}
| no | +| [mysqldb\_exporter\_enabled](#input\_mysqldb\_exporter\_enabled) | Specify whether or not to deploy Mysql exporter to collect Mysql metrics for monitoring in Grafana. | `bool` | `false` | no | +| [mysqldb\_restore\_config](#input\_mysqldb\_restore\_config) | Configuration options for restoring dump to the MySQL database. | `any` |
{
"s3_bucket_region": "",
"s3_bucket_uri": ""
}
| no | +| [mysqldb\_restore\_enabled](#input\_mysqldb\_restore\_enabled) | Specifies whether to enable restoring dump to the MySQL database. | `bool` | `false` | no | +| [namespace](#input\_namespace) | Name of the Kubernetes namespace where the MYSQL deployment will be deployed. | `string` | `"mysqldb"` | no | +| [recovery\_window\_aws\_secret](#input\_recovery\_window\_aws\_secret) | Number of days that AWS Secrets Manager will wait before deleting a secret. This value can be set to 0 to force immediate deletion, or to a value between 7 and 30 days to allow for recovery. | `number` | `0` | no | ## Outputs | Name | Description | |------|-------------| -| [mysqldb](#output\_mysqldb) | MysqlDB\_Info | +| [mysqldb](#output\_mysqldb) | Mysql\_Info | ## Contribution & Issue Reporting diff --git a/examples/complete/README.md b/examples/complete/README.md index 7834bed..2aa9adb 100644 --- a/examples/complete/README.md +++ b/examples/complete/README.md @@ -21,7 +21,7 @@ No requirements. | Name | Source | Version | |------|--------|---------| -| [mysql](#module\_mysql) | ../../ | n/a | +| [mysql](#module\_mysql) | https://github.com/sq-ia/terraform-kubernetes-mysql.git | n/a | ## Resources @@ -38,5 +38,5 @@ No inputs. | Name | Description | |------|-------------| -| [mysql\_configuration](#output\_mysql\_configuration) | mysql\_Info | +| [mysql\_configuration](#output\_mysql\_configuration) | Mysql\_Info | diff --git a/examples/complete/main.tf b/examples/complete/main.tf index 9790a0c..bdc3e12 100644 --- a/examples/complete/main.tf +++ b/examples/complete/main.tf @@ -1,12 +1,17 @@ locals { - name = "test" - region = "ap-south-1" - environment = "squareops" + name = "mysql" + region = "us-east-2" + environment = "prod" + additional_tags = { + Owner = "organization_name" + Expires = "Never" + Department = "Engineering" + } } module "mysql" { - source = "../../" - cluster_name = "test-squareops" + source = "https://github.com/sq-ia/terraform-kubernetes-mysql.git" + cluster_name = "" mysqldb_config = { name = local.name values_yaml = file("./helm/values.yaml") @@ -28,7 +33,6 @@ module "mysql" { mysqldb_restore_config = { s3_bucket_uri = "s3://mysqldumprestore/10-dump.sql" s3_bucket_region = "us-east-2" - } - mysqldb_exporter_enabled = false + mysqldb_exporter_enabled = true } diff --git a/examples/complete/output.tf b/examples/complete/output.tf index 73d7dcd..52cf30b 100644 --- a/examples/complete/output.tf +++ b/examples/complete/output.tf @@ -1,4 +1,4 @@ output "mysql_configuration" { value = module.mysql.mysqldb - description = "mysql_Info" + description = "Mysql_Info" } diff --git a/examples/complete/provider.tf b/examples/complete/provider.tf index 948e969..086a20e 100644 --- a/examples/complete/provider.tf +++ b/examples/complete/provider.tf @@ -1,14 +1,17 @@ provider "aws" { region = local.region + default_tags { + tags = local.additional_tags + } } data "aws_eks_cluster" "cluster" { - name = "dev-skaf" + name = "" } data "aws_eks_cluster_auth" "cluster" { - name = "dev-skaf" + name = "" } diff --git a/output.tf b/output.tf index 048aca2..3f0cd0b 100644 --- a/output.tf +++ b/output.tf @@ -1,5 +1,5 @@ output "mysqldb" { - description = "MysqlDB_Info" + description = "Mysql_Info" value = { mysqlport = "3306", mysql_primary_endpoint = "mysqldb-primary.${var.namespace}.svc.cluster.local", diff --git a/variables.tf b/variables.tf index 7907d69..2e00aeb 100644 --- a/variables.tf +++ b/variables.tf @@ -11,30 +11,30 @@ variable "mysqldb_config" { secondary_db_volume_size = "" secondary_db_replica_count = 1 } - description = "Mysql configurations" + description = "Specify the configuration settings for MySQL, including the name, environment, storage options, replication settings, and custom YAML values." } variable "app_version" { type = string default = "8.0.29-debian-11-r9" - description = "App version" + description = "Version of the MySQL application that will be deployed." } variable "chart_version" { type = string default = "9.2.0" - description = "Chart version" + description = "Version of the Mysql chart that will be used to deploy MySQL application." } variable "namespace" { type = string default = "mysqldb" - description = "Namespace name" + description = "Name of the Kubernetes namespace where the MYSQL deployment will be deployed." } variable "mysqldb_backup_enabled" { type = bool default = false - description = "Set true to enable mysql backups" + description = "Specifies whether to enable backups for MySQL database." } variable "mysqldb_backup_config" { @@ -44,37 +44,37 @@ variable "mysqldb_backup_config" { s3_bucket_region = "" cron_for_full_backup = "" } - description = "Mysql Backup configurations" + description = "configuration options for MySQL database backups. It includes properties such as the S3 bucket URI, the S3 bucket region, and the cron expression for full backups." } variable "mysqldb_exporter_enabled" { type = bool default = false - description = "Set true to deploy mysqldb exporters to get metrics in grafana" + description = "Specify whether or not to deploy Mysql exporter to collect Mysql metrics for monitoring in Grafana." } variable "recovery_window_aws_secret" { type = number default = 0 - description = "Number of days that AWS Secrets Manager waits before it can delete the secret. This value can be 0 to force deletion without recovery or range from 7 to 30 days." + description = "Number of days that AWS Secrets Manager will wait before deleting a secret. This value can be set to 0 to force immediate deletion, or to a value between 7 and 30 days to allow for recovery." } variable "cluster_name" { type = string default = "" - description = "Name of the EKS cluster" + description = "Specifies the name of the EKS cluster to deploy the MySQL application on." } variable "create_namespace" { type = string - description = "Set it to true to create given namespace" + description = "Specify whether or not to create the namespace if it does not already exist. Set it to true to create the namespace." default = true } variable "mysqldb_restore_enabled" { type = bool default = false - description = "Set true to enable mysql restore" + description = "Specifies whether to enable restoring dump to the MySQL database." } variable "mysqldb_restore_config" { @@ -83,5 +83,5 @@ variable "mysqldb_restore_config" { s3_bucket_uri = "" s3_bucket_region = "" } - description = "Mysql Restore configurations" + description = "Configuration options for restoring dump to the MySQL database." }