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