Loading Secrets Using a Cloud Secret Store
Solace Agent Mesh resolves ${VAR} references in your resource files when sam config apply runs, reading each value from the manifest's variables block first and then from the process environment. Agent Mesh does not call AWS Secrets Manager, Google Cloud Secret Manager, or Azure Key Vault itself.
If the pipeline that runs sam config apply has identity-based access to a cloud secret store, a pipeline step reads each secret into an environment variable, and sam config apply resolves ${VAR} from that variable. Your committed configuration holds only variable names, so the secret values stay out of the repository. Agent Mesh does not control your build artifacts or pipeline logs. Your pipeline must keep the values out of both.
For how ${VAR} substitution and vault:// references work in general, see Secrets and Variables. For running sam config apply in CI, see Targets and Authentication.
The Pattern
The pattern has three parts:
- A cloud identity for the pipeline. The pipeline runs with an identity that can read the required secrets. Setting it up is a cloud-platform task, outside the scope of Agent Mesh. The common options for each platform are:
Amazon Elastic Kubernetes Service (Amazon EKS): AWS Identity and Access Management (IAM) roles for service accounts (IRSA)
Amazon Elastic Compute Cloud (Amazon EC2): an instance profile
Amazon Elastic Container Service (Amazon ECS) on AWS Fargate: a task IAM role
Google Kubernetes Engine (GKE): Workload Identity Federation for GKE
Azure Kubernetes Service (AKS): Microsoft Entra Workload ID
-
A fetch step. A pipeline step uses that identity to read each required secret with your cloud provider's CLI or software development kit (SDK) and exports it as an environment variable. If your pipeline script turns on command tracing with
set -x, turn it off withset +xbefore the first line that fetches a secret. -
sam config apply. The command reads the environment, substitutes${VAR}references in the resource files, and sends only the resolved configuration to the Platform service.
The following example shows a committed resource file that references a variable, never a value:
# models/general.yaml
kind: model
name: general
description: General-purpose model alias.
spec:
provider: anthropic
modelName: claude-sonnet-4-5
authConfig:
type: apikey
api_key: ${ANTHROPIC_API_KEY}
The sam config plan command resolves ${VAR} the same way, so a pipeline step that runs plan also requires the variables.
If the manifest's variables block defines the same name as a variable that your pipeline exports, the value in the variables block takes precedence over the environment.
Stop on a Failed or Empty Fetch
A variable that is unset and has no default stops sam config plan and sam config apply with an error. A variable set to an empty string does not.
When a variable is set to an empty string, Agent Mesh substitutes the empty value instead of reporting an error. The result depends on the field:
-
A required secret field on an existing resource keeps its stored value, so a rotated secret does not take effect even though the pipeline reports success.
-
An optional secret field on an existing resource loses its stored value.
-
A secret field on a new resource has no value. Some resource kinds reject the empty value when you create the resource; others accept it, and the resource fails at runtime.
To prevent an empty value from reaching Agent Mesh, make the fetch step fail when it returns nothing. In Bash, assign the variable, check that it is not empty, and then export it:
ANTHROPIC_API_KEY=$(your-secret-fetch-command)
: "${ANTHROPIC_API_KEY:?missing from the secret store}"
export ANTHROPIC_API_KEY
Avoid export ANTHROPIC_API_KEY=$(your-secret-fetch-command) on one line. The line takes the exit status of export, not of the fetch command, so set -e does not stop the pipeline when the fetch fails.
Cloud Provider Reference
For the exact command that reads a secret from the store, and for how to give your pipeline a cloud identity with least-privilege access to the required secrets, see your cloud provider's documentation.
AWS Secrets Manager
-
Identity on Amazon EKS: IAM roles for service accounts
-
Identity on Amazon EC2: IAM roles for Amazon EC2
-
Identity on Amazon ECS with AWS Fargate: Amazon ECS task IAM role
Google Cloud Secret Manager
-
Identity on GKE: Authenticate to Google Cloud APIs from GKE workloads
Azure Key Vault
-
Identity on AKS: Use Microsoft Entra Workload ID with Azure Kubernetes Service (AKS)
When to Choose Vault References Instead
If you run HashiCorp Vault, Agent Mesh resolves vault:// references directly, with no pipeline-side fetch step. For more information, see Vault References.
Choose vault:// when:
-
Your secrets live in Vault, and the machine that runs
sam config applyhasVAULT_ADDRset and a Vault token, either inVAULT_TOKENor in a~/.vault-tokenfile. -
You want one secret backend across many tools, not just Agent Mesh.
Choose the cloud-store ${VAR} pattern when:
-
Your secrets live in AWS Secrets Manager, Google Cloud Secret Manager, or Azure Key Vault, and the pipeline runs with a cloud identity that can read them.
-
You do not run Vault, or Vault is not reachable from the pipeline.
You can combine the two patterns. One resource file can mix ${VAR} references for cloud-store secrets with vault:// references for Vault-managed secrets.
Related Topics
-
Secrets and Variables covers
${VAR}substitution rules, where values come from, andvault://references. -
The Manifest covers the
variablesblock, which takes precedence over the environment. -
Targets and Authentication covers how
sam config applyauthenticates to the Platform service in CI. -
Planning and Applying Changes covers
sam config planandsam config applyend to end.