Resource Definitions

Driver

Capability

Flavor

Resource Type

Postgres

This section contains example Resource Definitions using the Echo Driver for PostgreSQL.

  • postgres-secretstore.yaml: Shows how to use the Echo Driver and secret references to fetch database credentials from an external secret store. This format is for use with the Humanitec CLI .

Resource Definitions


postgres-secretstore.yaml ( view on GitHub ) :

apiVersion: entity.humanitec.io/v1b1
kind: Definition
metadata:
  id: postgres-echo
entity:
  name: postgres-echo
  type: postgres
  driver_type: humanitec/echo
  driver_inputs:
    values:
      name: my-database
      host: products.postgres.dev.example.com
      port: 5432
    secret_refs:
      username:
        store: my-gsm
        ref: cloudsql-username
      password:
        store: my-gsm
        ref: cloudsql-password
  criteria:
    - {}


postgres-secretstore.tf ( view on GitHub ) :

resource "humanitec_resource_definition" "postgres-echo" {
  driver_type = "humanitec/echo"
  id          = "postgres-echo"
  name        = "postgres-echo"
  type        = "postgres"
  driver_inputs = {
    values_string = jsonencode({
      "name" = "my-database"
      "host" = "products.postgres.dev.example.com"
      "port" = 5432
    })
    secret_refs = jsonencode({
      "username" = {
        "store" = "my-gsm"
        "ref"   = "cloudsql-username"
      }
      "password" = {
        "store" = "my-gsm"
        "ref"   = "cloudsql-password"
      }
    })
  }
}

resource "humanitec_resource_definition_criteria" "postgres-echo_criteria_0" {
  resource_definition_id = resource.humanitec_resource_definition.postgres-echo.id

}

Top