Using this module within OpenCloudCX will provision a MariaDB instance. This module can be used in multiple environments depending on the providers and DNS zones being defined. It is a good idea to have all modules, providers, and namespace creation in the same file.
Add the following module definition to the bootstrap project
module "mariadb" {
<source block>
dns_zone = "<dns zone>"
namespace = "<namespace>"
providers = {
kubernetes = <kubernetes provider reference>,
helm = <helm provider reference>
}
depends_on = [
<eks module reference>,
]
}
The source block will be in either of these formats
source = "<path to module>"
source = "git::ssh://git@github.com/<account or organization>/<repository>?ref=<branch>"
Note: If pulling from main
branch, ?ref=<branch>
is not necessary.
source = "<url to terraform module>"
version = "<version>"
Verion formatting of the terraform source block explained
Provider references should be supplied through the providers
configuration of the module. The main OpenCloudCX module will return all of the necessary information
provider "kubernetes" {
host = module.<opencloudcx-module>.aws_eks_cluster_endpoint
token = module.<opencloudcx-module>.aws_eks_cluster_auth_token
cluster_ca_certificate = module.<opencloudcx-module>.aws_eks_cluster_ca_certificate
}
provider "helm" {
kubernetes {
host = module.<opencloudcx-module>.aws_eks_cluster_endpoint
token = module.<opencloudcx-module>.aws_eks_cluster_auth_token
cluster_ca_certificate = module.<opencloudcx-module>.aws_eks_cluster_ca_certificate
}
}
Note: When multiple environments or cloud-providers are in use, the named module reference will need to be changed per environment.
This example also adds a kubernetes_namespace
definition to create the namespace if one does not already exist.
provider "kubernetes" {
host = module.opencloudcx-aws-dev.aws_eks_cluster_endpoint
token = module.opencloudcx-aws-dev.aws_eks_cluster_auth_token
cluster_ca_certificate = module.opencloudcx-aws-dev.aws_eks_cluster_ca_certificate
}
provider "helm" {
kubernetes {
host = module.opencloudcx-aws-dev.aws_eks_cluster_endpoint
token = module.opencloudcx-aws-dev.aws_eks_cluster_auth_token
cluster_ca_certificate = module.opencloudcx-aws-dev.aws_eks_cluster_ca_certificate
}
}
resource "kubernetes_namespace" "develop" {
metadata {
name = "develop"
}
depends_on = [
module.opencloudcx-aws-dev
]
}
module "mariadb" {
source = "git::ssh://git@github.com/OpenCloudCX/module-mariadb?ref=develop"
dns_zone = var.dns_zone
namespace = "develop"
providers = {
kubernetes = kubernetes,
helm = helm
}
depends_on = [
module.opencloudcx-aws-dev,
]
}
Name | URL | Username | Password Location |
---|---|---|---|
MariaDB root | None | None | AWS Secrets Manager [mariadb_root ] |