Resource Packs

Cloud

Example

Flavor

Feature

Redis

Example: redis resource using a Kubernetes Deployment

This example configures a redis Resource Definition using Kubernetes Deployment.

The created Resource Definition can be used in your Score file using:

resources:
  ...
  redis:
    type: redis

Requirements

Name Version
terraform >= 1.3.0
humanitec ~> 1.0

Providers

Name Version
humanitec ~> 1.0

Modules

Name Source Version
redis_basic ../../humanitec-resource-defs/redis/basic n/a

Resources

Name Type
humanitec_application.example resource
humanitec_resource_definition_criteria.redis_basic resource

Inputs

Name Description Type Default Required
name Name of the example application string "hum-rp-redis-example" no
prefix Prefix of the created resources string "hum-rp-redis-ex-" no

main.tf (view on GitHub) :

resource "humanitec_application" "example" {
  id   = var.name
  name = var.name
}

# redis resource definition

module "redis_basic" {
  source = "github.com/humanitec-architecture/resource-packs-in-cluster//humanitec-resource-defs/redis/basic"

  prefix = var.prefix
}

resource "humanitec_resource_definition_criteria" "redis_basic" {
  resource_definition_id = module.redis_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-redis-example"

# Prefix of the created resources
prefix = "hum-rp-redis-ex-"

variables.tf (view on GitHub) :

variable "name" {
  description = "Name of the example application"
  type        = string
  default     = "hum-rp-redis-example"
}

variable "prefix" {
  description = "Prefix of the created resources"
  type        = string
  default     = "hum-rp-redis-ex-"
}

Top