Skip to content

OpenCloudCX/module-mariadb

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

OpenCloudCX MariaDB Module

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.

Setup

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>,
  ]
}

Source block

The source block will be in either of these formats

Local filesystem

source = "<path to module>"

Git repository

source = "git::ssh://git@github.com/<account or organization>/<repository>?ref=<branch>"

Note: If pulling from main branch, ?ref=<branch> is not necessary.

Terraform module

source  = "<url to terraform module>"
version = "<version>"

Verion formatting of the terraform source block explained

Providers

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.

Module example with Git repository reference

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,
  ]
}

Credentials

Name URL Username Password Location
MariaDB root None None AWS Secrets Manager [mariadb_root]

About

OpenCloudCX module for MariaDB

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages