diff --git a/modules/ionos-datacenter/README.md b/modules/ionos-datacenter/README.md
index 29e9240..24e5916 100644
--- a/modules/ionos-datacenter/README.md
+++ b/modules/ionos-datacenter/README.md
@@ -19,6 +19,7 @@ No modules.
| [create\_alb\_target\_lan](#input\_create\_alb\_target\_lan) | Specifies whether a private target for the Application Load Balancer shall be created. | `bool` | `false` | no |
| [create\_backend\_crossconnect](#input\_create\_backend\_crossconnect) | Specifies whether crossconnect shall be created. Default: false. | `bool` | `false` | no |
| [create\_frontend\_crossconnect](#input\_create\_frontend\_crossconnect) | Specifies whether crossconnect shall be created. Default: false. | `bool` | `false` | no |
+| [create\_mariadb\_lan](#input\_create\_mariadb\_lan) | Specifies whether a private lan to connect Mariadb shall be created. | `bool` | `false` | no |
| [create\_nat\_lan](#input\_create\_nat\_lan) | Specifies whether a private lan to connect a NAT gateway shall be created. | `bool` | `false` | no |
| [create\_nfs\_server\_lan](#input\_create\_nfs\_server\_lan) | Specifies whether a private lan to connect an NFS server shall be created. | `bool` | `false` | no |
| [create\_nlb\_target\_lan](#input\_create\_nlb\_target\_lan) | Specifies whether a private target for the Network Load Balancer shall be created. | `bool` | `false` | no |
@@ -45,12 +46,14 @@ No modules.
| [lan\_alb\_target](#output\_lan\_alb\_target) | n/a |
| [lan\_backend](#output\_lan\_backend) | n/a |
| [lan\_frontend](#output\_lan\_frontend) | n/a |
+| [lan\_mariadb](#output\_lan\_mariadb) | n/a |
| [lan\_nat](#output\_lan\_nat) | n/a |
| [lan\_nfs\_server](#output\_lan\_nfs\_server) | n/a |
| [lan\_nlb\_target](#output\_lan\_nlb\_target) | n/a |
| [lan\_postgres](#output\_lan\_postgres) | n/a |
| [lan\_service](#output\_lan\_service) | n/a |
| [lans\_custom](#output\_lans\_custom) | n/a |
+| [mariadb\_lan\_id](#output\_mariadb\_lan\_id) | n/a |
| [nat\_lan\_id](#output\_nat\_lan\_id) | n/a |
| [nfs\_server\_lan\_id](#output\_nfs\_server\_lan\_id) | n/a |
| [nlb\_target\_lan\_id](#output\_nlb\_target\_lan\_id) | n/a |
@@ -71,6 +74,7 @@ No modules.
| [ionoscloud_lan.backend_lan](https://registry.terraform.io/providers/ionos-cloud/ionoscloud/6.3.6/docs/resources/lan) | resource |
| [ionoscloud_lan.custom_lan](https://registry.terraform.io/providers/ionos-cloud/ionoscloud/6.3.6/docs/resources/lan) | resource |
| [ionoscloud_lan.frontend_lan](https://registry.terraform.io/providers/ionos-cloud/ionoscloud/6.3.6/docs/resources/lan) | resource |
+| [ionoscloud_lan.mariadb_lan](https://registry.terraform.io/providers/ionos-cloud/ionoscloud/6.3.6/docs/resources/lan) | resource |
| [ionoscloud_lan.nat_lan](https://registry.terraform.io/providers/ionos-cloud/ionoscloud/6.3.6/docs/resources/lan) | resource |
| [ionoscloud_lan.nfs_server_lan](https://registry.terraform.io/providers/ionos-cloud/ionoscloud/6.3.6/docs/resources/lan) | resource |
| [ionoscloud_lan.nlb_target_lan](https://registry.terraform.io/providers/ionos-cloud/ionoscloud/6.3.6/docs/resources/lan) | resource |
diff --git a/modules/ionos-datacenter/locals.tf b/modules/ionos-datacenter/locals.tf
index c58163b..1e77e64 100644
--- a/modules/ionos-datacenter/locals.tf
+++ b/modules/ionos-datacenter/locals.tf
@@ -15,6 +15,7 @@ locals {
service_crossconnect_shared_group_ids = (length(var.crossconnect_shared_group_ids) > 0 && local.create_frontend_crossconnect == true) ? var.crossconnect_shared_group_ids : []
routes_map = var.routes_map
create_postgres_lan = var.create_postgres_lan
+ create_mariadb_lan = var.create_mariadb_lan
custom_lans_to_create = var.custom_lans_to_create
# this saves the service/backend/frontend lans as an object in a list
# Example of an object:
@@ -34,6 +35,7 @@ locals {
lan_frontend = flatten([ for id in ionoscloud_lan.frontend_lan.*.id: { id = id, routes_list = lookup(local.routes_map, id , [{}]) }])
lan_nfs_server = flatten([ for id in ionoscloud_lan.nfs_server_lan.*.id: { id = id, routes_list = [{}] }])
lan_postgres = flatten([ for id in ionoscloud_lan.postgres_lan.*.id: { id = id, routes_list = [{}] }])
+ lan_mariadb = flatten([ for id in ionoscloud_lan.mariadb_lan.*.id: { id = id, routes_list = [{}] }])
lan_alb_target = flatten([ for id in ionoscloud_lan.alb_target_lan.*.id: { id = id, routes_list =[{}] }])
lan_nlb_target = flatten([ for id in ionoscloud_lan.nlb_target_lan.*.id: { id = id, routes_list =[{}] }])
lan_nat = flatten([ for id in ionoscloud_lan.nat_lan.*.id: { id = id, routes_list = [{}] }])
diff --git a/modules/ionos-datacenter/main.tf b/modules/ionos-datacenter/main.tf
index 78cc1e2..8d78f00 100644
--- a/modules/ionos-datacenter/main.tf
+++ b/modules/ionos-datacenter/main.tf
@@ -98,6 +98,13 @@ resource "ionoscloud_lan" "postgres_lan" {
public = false
}
+resource "ionoscloud_lan" "mariadb_lan" {
+ count = local.create_mariadb_lan ? 1 : 0
+ name = "${var.datacenter_name}-mariadb-lan"
+ datacenter_id = ionoscloud_datacenter.datacenter.id
+ public = false
+}
+
resource "ionoscloud_lan" "alb_target_lan" {
count = local.create_alb_target_lan ? 1 : 0
name = "${var.datacenter_name}-alb-target-lan"
diff --git a/modules/ionos-datacenter/output.tf b/modules/ionos-datacenter/output.tf
index 41d4836..e416230 100644
--- a/modules/ionos-datacenter/output.tf
+++ b/modules/ionos-datacenter/output.tf
@@ -55,6 +55,14 @@ output "lan_postgres" {
value = local.lan_postgres
}
+output "mariadb_lan_id" {
+ value = join("", ionoscloud_lan.mariadb_lan.*.id)
+}
+
+output "lan_mariadb" {
+ value = local.lan_mariadb
+}
+
output "alb_target_lan_id" {
value = join("", ionoscloud_lan.alb_target_lan.*.id)
}
diff --git a/modules/ionos-datacenter/variables.tf b/modules/ionos-datacenter/variables.tf
index 8c553a8..095e03c 100644
--- a/modules/ionos-datacenter/variables.tf
+++ b/modules/ionos-datacenter/variables.tf
@@ -84,6 +84,11 @@ variable "create_postgres_lan" {
type = bool
default = false
}
+variable "create_mariadb_lan" {
+ description = "Specifies whether a private lan to connect Mariadb shall be created."
+ type = bool
+ default = false
+}
variable "create_alb_target_lan" {
type = bool
diff --git a/modules/ionos-mariadb-cluster/README.md b/modules/ionos-mariadb-cluster/README.md
new file mode 100644
index 0000000..f647e4b
--- /dev/null
+++ b/modules/ionos-mariadb-cluster/README.md
@@ -0,0 +1,48 @@
+
+
+## Providers
+
+| Name | Version |
+|------|---------|
+| [ionoscloud](#provider\_ionoscloud) | 6.3.6 |
+## Modules
+
+| Name | Source | Version |
+|------|--------|---------|
+| [cidr\_workaround](#module\_cidr\_workaround) | ../../modules/ionos-cidr-workaround | n/a |
+## Inputs
+
+| Name | Description | Type | Default | Required |
+|------|-------------|------|---------|:--------:|
+| [cores](#input\_cores) | The number of CPU cores per instance | `number` | n/a | yes |
+| [datacenter\_id](#input\_datacenter\_id) | The datacenter to connect your cluster to. | `string` | n/a | yes |
+| [display\_name](#input\_display\_name) | The friendly name of your cluster | `string` | n/a | yes |
+| [instances\_count](#input\_instances\_count) | The total number of instances in the cluster (one primary and n-1 secondary) | `number` | n/a | yes |
+| [k8s\_cluster\_id](#input\_k8s\_cluster\_id) | n/a | `string` | n/a | yes |
+| [lan\_id](#input\_lan\_id) | The LAN to connect your cluster to. | `string` | n/a | yes |
+| [mariadb\_version](#input\_mariadb\_version) | The MariaDB version of your cluster | `string` | n/a | yes |
+| [memory](#input\_memory) | The amount of memory per instance in gigabytes (GB) | `number` | n/a | yes |
+| [password](#input\_password) | The password for the initial MariaDB user | `string` | n/a | yes |
+| [username](#input\_username) | The username for the initial MariaDB user | `string` | n/a | yes |
+| [volume\_size](#input\_volume\_size) | The amount of storage per instance in gigabytes (GB) | `number` | n/a | yes |
+| [ip\_block](#input\_ip\_block) | The number to be set in the last ip block. (Default: 101) | `number` | `101` | no |
+| [maintenance\_day](#input\_maintenance\_day) | The day of the week for the 4 hour-long maintenance window. (Default: Sunday) | `string` | `"Sunday"` | no |
+| [maintenance\_hour](#input\_maintenance\_hour) | The time of the day when the 4 hour-long maintenance window may start. (Default: 3) | `number` | `3` | no |
+| [subnet\_mask](#input\_subnet\_mask) | The subnet mask to use for allowing connections from the LAN. (Default: 16) | `string` | `16` | no |
+## Outputs
+
+| Name | Description |
+|------|-------------|
+| [dns\_name](#output\_dns\_name) | The DNS name pointing to your cluster. |
+## Requirements
+
+| Name | Version |
+|------|---------|
+| [terraform](#requirement\_terraform) | >= 0.13 |
+| [ionoscloud](#requirement\_ionoscloud) | 6.3.6 |
+## Resources
+
+| Name | Type |
+|------|------|
+| [ionoscloud_mariadb_cluster.mariadb_cluster](https://registry.terraform.io/providers/ionos-cloud/ionoscloud/6.3.6/docs/resources/mariadb_cluster) | resource |
+
\ No newline at end of file
diff --git a/modules/ionos-mariadb-cluster/cidr-workaround.tf b/modules/ionos-mariadb-cluster/cidr-workaround.tf
new file mode 100644
index 0000000..4d54ef5
--- /dev/null
+++ b/modules/ionos-mariadb-cluster/cidr-workaround.tf
@@ -0,0 +1,12 @@
+module "cidr_workaround" {
+ source = "../../modules/ionos-cidr-workaround"
+ k8s_cluster_id = var.k8s_cluster_id
+ lan_id = var.lan_id
+}
+
+locals {
+ nicIndex = module.cidr_workaround.nicIndex
+ prefix = module.cidr_workaround.prefix
+ full_ip = cidrhost(local.prefix, var.ip_block)
+ cidr = format("%s/%s", local.full_ip, var.subnet_mask)
+}
diff --git a/modules/ionos-mariadb-cluster/main.tf b/modules/ionos-mariadb-cluster/main.tf
new file mode 100644
index 0000000..ac6b4bf
--- /dev/null
+++ b/modules/ionos-mariadb-cluster/main.tf
@@ -0,0 +1,25 @@
+resource "ionoscloud_mariadb_cluster" "mariadb_cluster" {
+ mariadb_version = var.mariadb_version
+ instances = var.instances_count
+ cores = var.cores
+ ram = var.memory
+ storage_size = var.volume_size
+
+ connections {
+ datacenter_id = var.datacenter_id
+ lan_id = var.lan_id
+ cidr = local.cidr
+ }
+ display_name = var.display_name
+
+ maintenance_window {
+ day_of_the_week = var.maintenance_day
+ time = format("%02d:00:00", var.maintenance_hour)
+ }
+
+ credentials {
+ username = var.username
+ password = var.password
+ }
+
+}
diff --git a/modules/ionos-mariadb-cluster/output.tf b/modules/ionos-mariadb-cluster/output.tf
new file mode 100644
index 0000000..7d210e8
--- /dev/null
+++ b/modules/ionos-mariadb-cluster/output.tf
@@ -0,0 +1,4 @@
+output "dns_name" {
+ description = "The DNS name pointing to your cluster."
+ value = ionoscloud_mariadb_cluster.mariadb_cluster.dns_name
+}
diff --git a/modules/ionos-mariadb-cluster/variables.tf b/modules/ionos-mariadb-cluster/variables.tf
new file mode 100644
index 0000000..4833f8c
--- /dev/null
+++ b/modules/ionos-mariadb-cluster/variables.tf
@@ -0,0 +1,65 @@
+variable "mariadb_version" {
+ description = "The MariaDB version of your cluster"
+ type = string
+}
+variable "instances_count" {
+ description = "The total number of instances in the cluster (one primary and n-1 secondary)"
+ type = number
+}
+variable "cores" {
+ description = "The number of CPU cores per instance"
+ type = number
+}
+variable "memory" {
+ description = "The amount of memory per instance in gigabytes (GB)"
+ type = number
+}
+variable "volume_size" {
+ description = "The amount of storage per instance in gigabytes (GB)"
+ type = number
+}
+variable "display_name" {
+ description = "The friendly name of your cluster"
+ type = string
+}
+variable "maintenance_day" {
+ description = "The day of the week for the 4 hour-long maintenance window. (Default: Sunday)"
+ type = string
+ default = "Sunday"
+}
+variable "maintenance_hour" {
+ description = "The time of the day when the 4 hour-long maintenance window may start. (Default: 3)"
+ type = number
+ default = 3
+}
+
+variable "username" {
+ description = "The username for the initial MariaDB user"
+ type = string
+}
+variable "password" {
+ description = "The password for the initial MariaDB user"
+ type = string
+}
+variable "k8s_cluster_id" {
+ description = ""
+ type = string
+}
+variable "lan_id" {
+ description = "The LAN to connect your cluster to."
+ type = string
+}
+variable "datacenter_id" {
+ description = "The datacenter to connect your cluster to."
+ type = string
+}
+variable "ip_block" {
+ description = "The number to be set in the last ip block. (Default: 101)"
+ type = number
+ default = 101
+}
+variable "subnet_mask" {
+ description = "The subnet mask to use for allowing connections from the LAN. (Default: 16)"
+ type = string
+ default = 16
+}
\ No newline at end of file
diff --git a/modules/ionos-mariadb-cluster/versions.tf b/modules/ionos-mariadb-cluster/versions.tf
new file mode 100644
index 0000000..d0372ea
--- /dev/null
+++ b/modules/ionos-mariadb-cluster/versions.tf
@@ -0,0 +1,9 @@
+terraform {
+ required_providers {
+ ionoscloud = {
+ source = "ionos-cloud/ionoscloud"
+ version = "6.3.6"
+ }
+ }
+ required_version = ">= 0.13"
+}