Mysql
Example: mysql resource using a Kubernetes StatefulSet
This example configures a mysql Resource Definition using Kubernetes StatefulSet.
The created Resource Definition can be used in your Score file using:
resources:
...
db:
type: mysql
Requirements
Name | Version |
---|---|
terraform | >= 1.3.0 |
humanitec | ~> 1.0 |
Providers
Name | Version |
---|---|
humanitec | ~> 1.0 |
Modules
Name | Source | Version |
---|---|---|
mysql_basic | ../../humanitec-resource-defs/mysql/basic | n/a |
Resources
Name | Type |
---|---|
humanitec_application.example | resource |
humanitec_resource_definition_criteria.mysql_basic | resource |
Inputs
Name | Description | Type | Default | Required |
---|---|---|---|---|
name | Name of the example application | string |
"hum-rp-mysql-example" |
no |
prefix | Prefix of the created resources | string |
"hum-rp-mysql-ex-" |
no |
main.tf
(view on GitHub)
:
resource "humanitec_application" "example" {
id = var.name
name = var.name
}
# mysql resource definition
module "mysql_basic" {
source = "github.com/humanitec-architecture/resource-packs-in-cluster//humanitec-resource-defs/mysql/basic"
prefix = var.prefix
}
resource "humanitec_resource_definition_criteria" "mysql_basic" {
resource_definition_id = module.mysql_basic.id
app_id = humanitec_application.example.id
class = "default"
force_delete = true
}
providers.tf
(view on GitHub)
:
terraform {
required_providers {
humanitec = {
source = "humanitec/humanitec"
version = "~> 1.0"
}
}
required_version = ">= 1.3.0"
}
provider "humanitec" {}
terraform.tfvars.example
(view on GitHub)
:
# Name of the example application
name = "hum-rp-mysql-example"
# Prefix of the created resources
prefix = "hum-rp-mysql-ex-"
variables.tf
(view on GitHub)
:
variable "name" {
description = "Name of the example application"
type = string
default = "hum-rp-mysql-example"
}
variable "prefix" {
description = "Prefix of the created resources"
type = string
default = "hum-rp-mysql-ex-"
}