Secrets

Encrypted values your apps get as environment variables.

Overview

A secret is a value kept encrypted — a password, an API key, a token. Apps get it as an environment variable; it never appears in responses, logs or events.

When to use it

  • An API key for a payment provider.
  • A database password.
  • A token EnclaveStack itself uses, like a DNS provider’s.

How it works

AES-256-GCM
Values are encrypted with the machine’s master key, which never leaves the machine.
Audited reveal
Reading a value is a separate call that needs edit rights and is recorded in the audit log.

The control plane decrypts a secret only to hand it to a container at start. Changing a secret takes effect on the next deploy of the apps that use it.

Architecture

Secrets architectureA secret is decrypted only to start a container.set valueat startYouconsole · CLI · OpenTofuEncrypted storeAES-256-GCM, master keyApp containerSTRIPE_KEY in env
A secret is decrypted only to start a container.
  • You to Encrypted store: set value
  • Encrypted store to App container: at start

Flows

Rotating a key

  1. Update the secret.
  2. Redeploy the apps that use it.
  3. They start with the new value.

Set it up

In the console

  1. Open Secrets and choose New secret.
  2. Name it and paste the value.
  3. In an app, add an environment variable from it.

With the CLI

enclave secret create stripe-key --value sk_test_123 --wait

With OpenTofu

OpenTofu configuration
resource "enclave_secret" "stripe_key" {
  name  = "stripe-key"
  value = var.stripe_key
}

Settings reference

Every setting and output of the OpenTofu resource; the console and the CLI use the same names in their own words. Generated from platform 4d30582.

enclave_secret
NameTypeUseWhat it does
nametextrequiredName of the secret: 3–40 lowercase letters, digits or hyphens, starting with a letter. Changing it replaces the secret.
projecttextoptionalThe project to create it in. Defaults to the provider's project (ENCLAVE_PROJECT, else default). Changing it replaces the resource.
sourcelist of objectsoptionalRead the value from a secret store of the project, and keep it in sync.
valuetextoptionalThe secret value (1 byte – 64 KiB). Changes in place. Exactly one of value and source.
idtextoutputResource ID.
synced_attextoutputWhen a synced secret was last read from its store.
versionnumberoutputIncrements each time the value changes.

Limits and security

Good to know

  • Secrets made for databases and other services are managed for you.

Security

  • Never in API responses, logs or events; every reveal is audited.