Echo Driver

Resource Definitions using the Echo Driver

This section contains example Resource Definitions using the Echo Driver .

Namespace

This section contains example Resource Definitions using the Echo Driver for managing Kubernetes namespaces .

  • custom-namespace.yaml: Shows how to use the Echo Driver to return the name of an externally managed namespace. This format is for use with the Humanitec CLI .
  • custom-namespace.tf: Shows how to use the Echo Driver to return the name of an externally managed namespace. This format is for use with the Humanitec Terraform provider .

custom-namespace.tf ( view on GitHub ) :

resource "humanitec_resource_definition" "namespace-echo" {
  driver_type = "humanitec/echo"
  id          = "namespace-echo"
  name        = "namespace-echo"
  type        = "k8s-namespace"
  driver_inputs = {
    values_string = jsonencode({
      "namespace" = "$${context.app.id}-$${context.env.id}"
    })
  }
}

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

}


custom-namespace.yaml ( view on GitHub ) :

apiVersion: entity.humanitec.io/v1b1
kind: Definition
metadata:
  id: namespace-echo
entity:
  name: namespace-echo
  type: k8s-namespace
  driver_type: humanitec/echo
  driver_inputs:
    values:
      namespace: "${context.app.id}-${context.env.id}"
  criteria:
    - {}

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 .

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

}


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:
    - {}

Redis

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


redis-secret-refs.tf ( view on GitHub ) :

resource "humanitec_resource_definition" "redis-echo" {
  driver_type = "humanitec/echo"
  id          = "redis-echo"
  name        = "redis-echo"
  type        = "redis"
  driver_inputs = {
    values_string = jsonencode({
      "host" = "0.0.0.0"
      "port" = 6379
    })
    secret_refs = jsonencode({
      "password" = {
        "store" = "my-gsm"
        "ref"   = "redis-password"
      }
      "username" = {
        "store" = "my-gsm"
        "ref"   = "redis-user"
      }
    })
  }
}

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

}


redis-secret-refs.yaml ( view on GitHub ) :

apiVersion: entity.humanitec.io/v1b1
kind: Definition
metadata:
  id: redis-echo
entity:
  name: redis-echo
  type: redis
  driver_type: humanitec/echo
  driver_inputs:
    values:
      host: 0.0.0.0
      port: 6379
    secret_refs:
      password:
        store: my-gsm
        ref: redis-password
      username:
        store: my-gsm
        ref: redis-user
  criteria:
    - {}

Top