New to Kestra?
Use blueprints to kickstart your first workflows.
Kestra flow that resolves DEV, STAGING, or PROD database secrets dynamically from a SELECT input using Pebble templating, injects them as env vars, and auto-redacts values from logs.
Hardcoding one flow per environment triples your maintenance surface; hand-rolling secret retrieval in every script triples it again. This Kestra blueprint solves both at once. A SELECT input chooses the environment, a Pebble expression builds the secret key at runtime ({{ secret(inputs.environment | upper ~ '_DB_PASSWORD') }}), and the resolved value lands in the script as a plain environment variable, auto-redacted from execution logs. The inline script doubles as documentation: it shows, side by side, the IAM-role-and-two-API-calls dance you skip by letting the orchestrator own secret resolution.
environment input (type: SELECT) offers dev, staging, or prod, defaulting to dev.fetch_secret_the_kestra_way task (io.kestra.plugin.scripts.shell.Commands) declares env.DB_PASSWORD as {{ secret(inputs.environment | upper ~ '_DB_PASSWORD') }}. Pebble uppercases the input and concatenates the suffix, so choosing staging resolves the STAGING_DB_PASSWORD secret at execution time.inputFiles, so the blueprint deploys standalone with no namespace files or repo checkout. It verifies DB_PASSWORD arrived, then "connects" using it. Kestra masks any secret() value that would appear in the logs.sts assume-role, no SSM or Secrets Manager calls, no jq plumbing.Every script that fetches its own secrets re-implements auth, error handling, and redaction, in every language your team uses. Kestra moves that concern into the platform: the secret() function resolves values from the configured secret backend at runtime, templating makes the lookup dynamic per input or environment, and injection happens through task env, so scripts stay portable and testable. Combined with inputs, one YAML definition covers your whole promotion path, and every execution records exactly which environment it ran against.
DEV_DB_PASSWORD, STAGING_DB_PASSWORD, PROD_DB_PASSWORD: the environment-specific database passwords. Only the one matching your chosen environment input needs to exist for a given run.DEV_DB_PASSWORD secret (any value works for the demo).company.team namespace.environment: dev and open the logs: the script confirms the secret arrived and the value is masked.psql, mysql, an API call) that consumes DB_PASSWORD.DB_HOST: "{{ secret(inputs.environment | upper ~ '_DB_HOST') }}".io.kestra.plugin.core.flow.Subflow to pass the environment down through an entire pipeline.