Random Creature
The random_creature resource generates friendly, memorable creature names combining adjectives and animal names. It provides consistent, deterministic name generation for creating user-friendly identifiers in lab environments.
Use Cases
Section titled “Use Cases”As a lab author, you can use random_creature resources to:
- User-Friendly Naming: Generate memorable, human-readable names for resources instead of cryptic identifiers
- Container Naming: Generate approachable names for containers that are easier to identify than random strings
Random creature resources create engaging, memorable identifiers while maintaining uniqueness and consistency.
HCL Syntax
Section titled “HCL Syntax”Basic Syntax
Section titled “Basic Syntax”resource "random_creature" "name" {}Full Syntax
Section titled “Full Syntax”resource "random_creature" "name" {}Fields
Section titled “Fields”This resource takes no input parameters. Creature names are generated automatically.
Computed Attributes
Section titled “Computed Attributes”These attributes are set by the system after creature name generation:
| Field | Type | Description | 
|---|---|---|
| value | string | The generated creature name (e.g., "brave-dolphin", "curious-elephant") | 
Validation Rules
Section titled “Validation Rules”- Creature names follow the pattern: adjective-animal
- Generated values remain constant across multiple runs (idempotent)
- Names are URL-safe and contain only lowercase letters and hyphens
- All generated names are family-friendly and appropriate for professional environments
Examples
Section titled “Examples”Simple Creature Name
Section titled “Simple Creature Name”resource "random_creature" "instance_name" {}
output "friendly_name" {  value = resource.random_creature.instance_name.value  # e.g., "brave-dolphin"}Container Naming
Section titled “Container Naming”resource "random_creature" "container_name" {}
resource "container" "app" {  image {    name = "myapp:latest"  }
  environment = {    INSTANCE_NAME = resource.random_creature.container_name.value  # e.g., "curious-elephant"  }}Lab Instance Identification
Section titled “Lab Instance Identification”resource "random_creature" "lab_id" {}
resource "template" "welcome_message" {  source = <<-EOF    Welcome to your lab instance: ${resource.random_creature.lab_id.value}  # e.g., "Welcome to your lab instance: gentle-penguin"
    You can refer to this instance as "${resource.random_creature.lab_id.value}" throughout the lab.
    Your unique lab environment is ready to use!  EOF
  destination = "./welcome.txt"}Team Assignment
Section titled “Team Assignment”resource "random_creature" "team_red" {}resource "random_creature" "team_blue" {}
resource "template" "team_config" {  source = <<-EOF    teams:      red:        name: ${resource.random_creature.team_red.value}        # e.g., "mighty-lion"        color: "#ff0000"        namespace: team-${resource.random_creature.team_red.value}
      blue:        name: ${resource.random_creature.team_blue.value}       # e.g., "swift-falcon"        color: "#0000ff"        namespace: team-${resource.random_creature.team_blue.value}  EOF
  destination = "./teams.yaml"}Service Discovery
Section titled “Service Discovery”resource "random_creature" "service_name" {}
resource "container" "api_service" {  image {    name = "api:latest"  }
  environment = {    SERVICE_ID = resource.random_creature.service_name.value     # e.g., "clever-owl"    SERVICE_URL = "http://${resource.random_creature.service_name.value}:8080"  }
  port {    local = 8080    host = 8080  }}
resource "template" "service_registry" {  source = <<-EOF    services:      - name: ${resource.random_creature.service_name.value}     # e.g., "clever-owl"        url: http://${resource.random_creature.service_name.value}:8080        health_check: /health        tags: ["api", "demo"]  EOF
  destination = "./services.yaml"}Multiple Lab Components
Section titled “Multiple Lab Components”resource "random_creature" "database_name" {}resource "random_creature" "cache_name" {}resource "random_creature" "worker_name" {}
resource "container" "database" {  image {    name = "postgres:15"  }
  environment = {    POSTGRES_DB = resource.random_creature.database_name.value   # e.g., "wise-turtle"  }}
resource "container" "cache" {  image {    name = "redis:alpine"  }}
resource "container" "worker" {  image {    name = "worker:latest"  }
  environment = {    DATABASE_HOST = "db-${resource.random_creature.database_name.value}"    # e.g., "db-wise-turtle"    CACHE_HOST = "cache-${resource.random_creature.cache_name.value}"       # e.g., "cache-quick-rabbit"    WORKER_ID = resource.random_creature.worker_name.value                  # e.g., "strong-bear"  }}User Simulation
Section titled “User Simulation”resource "random_creature" "user_alice" {}resource "random_creature" "user_bob" {}
resource "template" "mock_users" {  source = <<-EOF    users:      - username: alice        display_name: "Alice (${resource.random_creature.user_alice.value})"      # e.g., "Alice (friendly-cat)"        avatar: "/avatars/${resource.random_creature.user_alice.value}.png"
      - username: bob        display_name: "Bob (${resource.random_creature.user_bob.value})"          # e.g., "Bob (happy-dog)"        avatar: "/avatars/${resource.random_creature.user_bob.value}.png"  EOF
  destination = "./mock_users.yaml"}Network Naming
Section titled “Network Naming”resource "random_creature" "network_name" {}
resource "network" "lab_network" {  subnet = "10.0.0.0/24"}Best Practices
Section titled “Best Practices”- User Experience: Use creature names when human readability and memorability are important
- Consistent Prefixing: Add descriptive prefixes to creature names for resource type clarity
- Documentation: Include creature names in user-facing documentation and interfaces
- Accessibility: Creature names are more accessible than UUIDs or random strings
- Professional Environment: All generated names are appropriate for business and educational settings
- URL Safety: Creature names are safe to use in URLs, hostnames, and file names
- Logging: Include creature names in logs to make debugging more human-friendly
