Resource Definitions

Driver

Capability

Flavor

Resource Type

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 .

Resource Definitions


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


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

}

Top