Skip to content

Commit c12f735

Browse files
Merge pull request #4 from RohitSquareops/main
Updated variable, readme and indentation
2 parents 6c3af05 + 9bf7cad commit c12f735

File tree

7 files changed

+64
-44
lines changed

7 files changed

+64
-44
lines changed

README.md

Lines changed: 32 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,29 +5,42 @@
55

66
### [SquareOps Technologies](https://squareops.com/) Your DevOps Partner for Accelerating cloud journey.
77
<br>
8+
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.
9+
10+
## Supported Versions:
11+
12+
| MysqlDB Helm Chart Version | K8s supported version |
13+
| :-----: | :--- |
14+
| **9.2.0** | **1.23,1.24,1.25** |
15+
816

917
## Usage Example
1018

1119
```hcl
1220
module "mysql" {
13-
source = "../.."
14-
cluster_name = "dev-skaf"
21+
source = "https://github.com/sq-ia/terraform-kubernetes-mysql.git"
22+
cluster_name = "dev-cluster"
1523
mysqldb_config = {
1624
name = "skaf"
1725
values_yaml = ""
1826
environment = "prod"
1927
architecture = "replication"
20-
storage_class_name = "infra-service-sc"
28+
storage_class_name = "gp2"
2129
custom_user_username = "admin"
2230
primary_db_volume_size = "10Gi"
2331
secondary_db_volume_size = "10Gi"
2432
secondary_db_replica_count = 2
2533
}
2634
mysqldb_backup_enabled = true
2735
mysqldb_backup_config = {
28-
s3_bucket_uri = "s3://bucket-name"
29-
s3_bucket_region = "bucket-region"
30-
cron_for_full_backup = "*/2 * * * *"
36+
s3_bucket_uri = ""
37+
s3_bucket_region = ""
38+
cron_for_full_backup = "* * * * *"
39+
}
40+
mysqldb_restore_enabled = true
41+
mysqldb_restore_config = {
42+
s3_bucket_uri = ""
43+
s3_bucket_region = ""
3144
}
3245
mysqldb_exporter_enabled = true
3346
}
@@ -89,24 +102,24 @@ No modules.
89102

90103
| Name | Description | Type | Default | Required |
91104
|------|-------------|------|---------|:--------:|
92-
| <a name="input_app_version"></a> [app\_version](#input\_app\_version) | App version | `string` | `"8.0.29-debian-11-r9"` | no |
93-
| <a name="input_chart_version"></a> [chart\_version](#input\_chart\_version) | Chart version | `string` | `"9.2.0"` | no |
94-
| <a name="input_cluster_name"></a> [cluster\_name](#input\_cluster\_name) | Name of the EKS cluster | `string` | `""` | no |
95-
| <a name="input_create_namespace"></a> [create\_namespace](#input\_create\_namespace) | Set it to true to create given namespace | `string` | `true` | no |
96-
| <a name="input_mysqldb_backup_config"></a> [mysqldb\_backup\_config](#input\_mysqldb\_backup\_config) | Mysql Backup configurations | `any` | <pre>{<br> "cron_for_full_backup": "",<br> "s3_bucket_region": "",<br> "s3_bucket_uri": ""<br>}</pre> | no |
97-
| <a name="input_mysqldb_backup_enabled"></a> [mysqldb\_backup\_enabled](#input\_mysqldb\_backup\_enabled) | Set true to enable mysql backups | `bool` | `false` | no |
98-
| <a name="input_mysqldb_config"></a> [mysqldb\_config](#input\_mysqldb\_config) | Mysql configurations | `any` | <pre>{<br> "architecture": "",<br> "custom_user_username": "",<br> "environment": "",<br> "name": "",<br> "primary_db_volume_size": "",<br> "secondary_db_replica_count": 1,<br> "secondary_db_volume_size": "",<br> "storage_class_name": "",<br> "values_yaml": ""<br>}</pre> | no |
99-
| <a name="input_mysqldb_exporter_enabled"></a> [mysqldb\_exporter\_enabled](#input\_mysqldb\_exporter\_enabled) | Set true to deploy mysqldb exporters to get metrics in grafana | `bool` | `false` | no |
100-
| <a name="input_mysqldb_restore_config"></a> [mysqldb\_restore\_config](#input\_mysqldb\_restore\_config) | Mysql Restore configurations | `any` | <pre>{<br> "s3_bucket_region": "",<br> "s3_bucket_uri": ""<br>}</pre> | no |
101-
| <a name="input_mysqldb_restore_enabled"></a> [mysqldb\_restore\_enabled](#input\_mysqldb\_restore\_enabled) | Set true to enable mysql restore | `bool` | `false` | no |
102-
| <a name="input_namespace"></a> [namespace](#input\_namespace) | Namespace name | `string` | `"mysqldb"` | no |
103-
| <a name="input_recovery_window_aws_secret"></a> [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 |
105+
| <a name="input_app_version"></a> [app\_version](#input\_app\_version) | Version of the MySQL application that will be deployed. | `string` | `"8.0.29-debian-11-r9"` | no |
106+
| <a name="input_chart_version"></a> [chart\_version](#input\_chart\_version) | Version of the Mysql chart that will be used to deploy MySQL application. | `string` | `"9.2.0"` | no |
107+
| <a name="input_cluster_name"></a> [cluster\_name](#input\_cluster\_name) | Specifies the name of the EKS cluster to deploy the MySQL application on. | `string` | `""` | no |
108+
| <a name="input_create_namespace"></a> [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 |
109+
| <a name="input_mysqldb_backup_config"></a> [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` | <pre>{<br> "cron_for_full_backup": "",<br> "s3_bucket_region": "",<br> "s3_bucket_uri": ""<br>}</pre> | no |
110+
| <a name="input_mysqldb_backup_enabled"></a> [mysqldb\_backup\_enabled](#input\_mysqldb\_backup\_enabled) | Specifies whether to enable backups for MySQL database. | `bool` | `false` | no |
111+
| <a name="input_mysqldb_config"></a> [mysqldb\_config](#input\_mysqldb\_config) | Specify the configuration settings for MySQL, including the name, environment, storage options, replication settings, and custom YAML values. | `any` | <pre>{<br> "architecture": "",<br> "custom_user_username": "",<br> "environment": "",<br> "name": "",<br> "primary_db_volume_size": "",<br> "secondary_db_replica_count": 1,<br> "secondary_db_volume_size": "",<br> "storage_class_name": "",<br> "values_yaml": ""<br>}</pre> | no |
112+
| <a name="input_mysqldb_exporter_enabled"></a> [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 |
113+
| <a name="input_mysqldb_restore_config"></a> [mysqldb\_restore\_config](#input\_mysqldb\_restore\_config) | Configuration options for restoring dump to the MySQL database. | `any` | <pre>{<br> "s3_bucket_region": "",<br> "s3_bucket_uri": ""<br>}</pre> | no |
114+
| <a name="input_mysqldb_restore_enabled"></a> [mysqldb\_restore\_enabled](#input\_mysqldb\_restore\_enabled) | Specifies whether to enable restoring dump to the MySQL database. | `bool` | `false` | no |
115+
| <a name="input_namespace"></a> [namespace](#input\_namespace) | Name of the Kubernetes namespace where the MYSQL deployment will be deployed. | `string` | `"mysqldb"` | no |
116+
| <a name="input_recovery_window_aws_secret"></a> [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 |
104117

105118
## Outputs
106119

107120
| Name | Description |
108121
|------|-------------|
109-
| <a name="output_mysqldb"></a> [mysqldb](#output\_mysqldb) | MysqlDB\_Info |
122+
| <a name="output_mysqldb"></a> [mysqldb](#output\_mysqldb) | Mysql\_Info |
110123
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
111124

112125
## Contribution & Issue Reporting

examples/complete/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ No requirements.
2121

2222
| Name | Source | Version |
2323
|------|--------|---------|
24-
| <a name="module_mysql"></a> [mysql](#module\_mysql) | ../../ | n/a |
24+
| <a name="module_mysql"></a> [mysql](#module\_mysql) | https://github.com/sq-ia/terraform-kubernetes-mysql.git | n/a |
2525

2626
## Resources
2727

@@ -38,5 +38,5 @@ No inputs.
3838

3939
| Name | Description |
4040
|------|-------------|
41-
| <a name="output_mysql_configuration"></a> [mysql\_configuration](#output\_mysql\_configuration) | mysql\_Info |
41+
| <a name="output_mysql_configuration"></a> [mysql\_configuration](#output\_mysql\_configuration) | Mysql\_Info |
4242
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->

examples/complete/main.tf

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
11
locals {
2-
name = "test"
3-
region = "ap-south-1"
4-
environment = "squareops"
2+
name = "mysql"
3+
region = "us-east-2"
4+
environment = "prod"
5+
additional_tags = {
6+
Owner = "organization_name"
7+
Expires = "Never"
8+
Department = "Engineering"
9+
}
510
}
611

712
module "mysql" {
8-
source = "../../"
9-
cluster_name = "test-squareops"
13+
source = "https://github.com/sq-ia/terraform-kubernetes-mysql.git"
14+
cluster_name = ""
1015
mysqldb_config = {
1116
name = local.name
1217
values_yaml = file("./helm/values.yaml")
@@ -28,7 +33,6 @@ module "mysql" {
2833
mysqldb_restore_config = {
2934
s3_bucket_uri = "s3://mysqldumprestore/10-dump.sql"
3035
s3_bucket_region = "us-east-2"
31-
3236
}
33-
mysqldb_exporter_enabled = false
37+
mysqldb_exporter_enabled = true
3438
}

examples/complete/output.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
output "mysql_configuration" {
22
value = module.mysql.mysqldb
3-
description = "mysql_Info"
3+
description = "Mysql_Info"
44
}

examples/complete/provider.tf

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
11
provider "aws" {
22
region = local.region
3+
default_tags {
4+
tags = local.additional_tags
5+
}
36
}
47

58

69
data "aws_eks_cluster" "cluster" {
7-
name = "dev-skaf"
10+
name = ""
811
}
912

1013
data "aws_eks_cluster_auth" "cluster" {
11-
name = "dev-skaf"
14+
name = ""
1215
}
1316

1417

output.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
output "mysqldb" {
2-
description = "MysqlDB_Info"
2+
description = "Mysql_Info"
33
value = {
44
mysqlport = "3306",
55
mysql_primary_endpoint = "mysqldb-primary.${var.namespace}.svc.cluster.local",

variables.tf

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,30 +11,30 @@ variable "mysqldb_config" {
1111
secondary_db_volume_size = ""
1212
secondary_db_replica_count = 1
1313
}
14-
description = "Mysql configurations"
14+
description = "Specify the configuration settings for MySQL, including the name, environment, storage options, replication settings, and custom YAML values."
1515
}
1616

1717
variable "app_version" {
1818
type = string
1919
default = "8.0.29-debian-11-r9"
20-
description = "App version"
20+
description = "Version of the MySQL application that will be deployed."
2121
}
2222

2323
variable "chart_version" {
2424
type = string
2525
default = "9.2.0"
26-
description = "Chart version"
26+
description = "Version of the Mysql chart that will be used to deploy MySQL application."
2727
}
2828

2929
variable "namespace" {
3030
type = string
3131
default = "mysqldb"
32-
description = "Namespace name"
32+
description = "Name of the Kubernetes namespace where the MYSQL deployment will be deployed."
3333
}
3434
variable "mysqldb_backup_enabled" {
3535
type = bool
3636
default = false
37-
description = "Set true to enable mysql backups"
37+
description = "Specifies whether to enable backups for MySQL database."
3838
}
3939

4040
variable "mysqldb_backup_config" {
@@ -44,37 +44,37 @@ variable "mysqldb_backup_config" {
4444
s3_bucket_region = ""
4545
cron_for_full_backup = ""
4646
}
47-
description = "Mysql Backup configurations"
47+
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."
4848
}
4949

5050
variable "mysqldb_exporter_enabled" {
5151
type = bool
5252
default = false
53-
description = "Set true to deploy mysqldb exporters to get metrics in grafana"
53+
description = "Specify whether or not to deploy Mysql exporter to collect Mysql metrics for monitoring in Grafana."
5454
}
5555

5656
variable "recovery_window_aws_secret" {
5757
type = number
5858
default = 0
59-
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."
59+
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."
6060
}
6161

6262
variable "cluster_name" {
6363
type = string
6464
default = ""
65-
description = "Name of the EKS cluster"
65+
description = "Specifies the name of the EKS cluster to deploy the MySQL application on."
6666
}
6767

6868
variable "create_namespace" {
6969
type = string
70-
description = "Set it to true to create given namespace"
70+
description = "Specify whether or not to create the namespace if it does not already exist. Set it to true to create the namespace."
7171
default = true
7272
}
7373

7474
variable "mysqldb_restore_enabled" {
7575
type = bool
7676
default = false
77-
description = "Set true to enable mysql restore"
77+
description = "Specifies whether to enable restoring dump to the MySQL database."
7878
}
7979

8080
variable "mysqldb_restore_config" {
@@ -83,5 +83,5 @@ variable "mysqldb_restore_config" {
8383
s3_bucket_uri = ""
8484
s3_bucket_region = ""
8585
}
86-
description = "Mysql Restore configurations"
86+
description = "Configuration options for restoring dump to the MySQL database."
8787
}

0 commit comments

Comments
 (0)