HashiConf is the annual conference for the HashiCorp ecosystem — Terraform, Vault, Consul, Nomad, and Packer. The 2025 edition included sessions on UUID usage across HashiCorp tools, covering how UUIDs tie together infrastructure provisioning (Terraform), secret management (Vault), and service discovery (Consul). Sessions examined UUID v5 deterministic naming for reproducible infrastructure, UUID v4 in Vault lease management, and Consul service identity. This page summarises the key patterns for infrastructure engineers.

Terraform uuidv5() for reproducible resource IDs

A session demonstrated using uuidv5() to create stable, reproducible infrastructure identifiers:

locals {
  # Deterministic UUID from application name and environment
  # Same value on every plan — no state dependency, works across team members
  app_uuid = uuidv5("dns", "${var.app_name}.${var.environment}.internal")

  # Per-resource UUIDs derived from the app UUID
  db_uuid  = uuidv5(local.app_uuid, "database")
  api_uuid = uuidv5(local.app_uuid, "api-service")
}

resource "aws_iam_role" "app" {
  name = "app-${var.environment}-${substr(local.app_uuid, 0, 8)}"

  tags = {
    AppUuid = local.app_uuid
    Env     = var.environment
  }
}

The uuidv5() function implements RFC 9562 §5.5 (SHA-1 namespace hashing). Using it for tag values means every terraform plan produces the same UUID for the same configuration — essential for GitOps workflows where infrastructure state must be reproducible. The Terraform uuidv5() documentation lists built-in namespaces: "dns", "url", "oid", "x500".

Vault lease IDs in application code

import hvac
import os

client = hvac.Client(url='https://vault.example.com', token=os.environ['VAULT_TOKEN'])

# Request dynamic database credentials
response = client.secrets.database.generate_credentials(name='my-app-db-role')
lease_id = response['lease_id']   # UUID v4 format
username = response['data']['username']
password = response['data']['password']

print(f"Lease: {lease_id}")
# "database/creds/my-app-db-role/AbcDef12-..." (UUID v4)

# Renew the lease before it expires
client.sys.renew_secret(lease_id=lease_id, increment=3600)

Vault lease IDs are UUID v4 — fully random, no timestamp disclosure. They are effectively capability tokens: possession of the lease ID allows renewal or revocation. Store and transmit them with the same care as the credentials they govern. The Vault lease documentation covers TTL, renewal limits, and the difference between lease and token.

Consul service identity with deterministic UUIDs

# consul/service.hcl
service {
  # Deterministic service ID — stable across redeployments
  id   = "api-prod-a8098c1a"   # Shortened UUID v5 of "api.prod.consul"
  name = "api"
  port = 8080

  check {
    id       = "api-health"
    http     = "http://localhost:8080/health"
    interval = "10s"
    timeout  = "2s"
  }
}

For Prometheus service discovery through Consul, stable service IDs mean consistent instance labels in metrics — no stale targets from ID changes on redeploy. Generate the UUID v5 outside Terraform and embed it as a Consul service configuration literal:

# Generate stable service ID from service name + datacenter
python3 -c "import uuid; print(uuid.uuid5(uuid.NAMESPACE_DNS, 'api.prod.consul'))"
# a8098c1a-f86e-5697-...

The Consul service configuration documentation covers the id, name, and address fields.

Nomad job and allocation IDs

HashiCorp Nomad assigns UUID v4 identifiers to every job, allocation, and deployment. These IDs appear in the Nomad API, UI, and CLI output. A session covered how UUID v4’s random format means Nomad IDs cannot be confused with Consul service IDs or Vault lease IDs even if they share the same storage system — the UUID format is universal but each system’s ID space is independent.

For application-level correlation (e.g. tracing a request through Nomad allocation → Consul service → Vault credential), use a UUID v7 correlation ID set at request ingress and propagated through all systems via headers. The correlation ID is not a Nomad/Consul/Vault system UUID — it is an application-level ID that references those resources.

HCP Terraform workspace and run UUIDs

HCP Terraform (formerly Terraform Cloud) exposes workspace, run, state version, and plan UUIDs through its API. These UUIDs are UUID v4 and appear in webhook payloads for CI/CD integrations:

{
  "run_id": "run-CZcmD7eagjhyX91H",
  "workspace": {
    "id": "ws-a8098c1a-f86e-4da4-bd1a-00112444be1e"
  }
}

Use these IDs to correlate Terraform runs with application deployments in audit systems. The HCP Terraform Run API documentation covers the run object schema and webhook event types.

Further reading

External references

Frequently asked questions

How does Terraform use UUID v5 for deterministic infrastructure IDs?

Terraform's built-in uuidv5() function generates a deterministic UUID by SHA-1 hashing a namespace UUID and a name string — the same inputs always produce the same output. This enables stable infrastructure IDs that can be computed from known configuration values without storing state. For example, uuidv5("dns", "myapp.prod.internal") produces the same UUID on every terraform plan, making it safe to use as a resource tag or naming component across environments and team members.

What are Vault lease IDs and how do they relate to UUIDs?

HashiCorp Vault assigns a UUID-format lease ID to every dynamic secret it issues — database credentials, AWS IAM credentials, certificates. The lease ID is used to renew or revoke the secret: vault lease renew <lease_id>. Vault lease IDs are UUID v4 (random) to ensure they cannot be predicted or enumerated. The Vault lease documentation covers lease duration, renewal, and revocation. Lease IDs appear in application logs — treat them as sensitive since possession grants secret renewal.

How does Consul use UUIDs for service registration?

HashiCorp Consul assigns a UUID to each registered service instance as a node ID and service ID. These IDs persist across Consul agent restarts and are used for health check routing and service mesh identity. If not specified, Consul generates a random UUID v4 for each registration. You can specify a deterministic UUID v5 based on the service name and datacenter to ensure stable IDs across re-deployments — useful for Prometheus monitoring where target labels must be consistent. The Consul service configuration documentation covers the id field.