atmos ai skill install atmos-storesAtmos External Stores
Stores are external key-value backends configured in atmos.yaml that enable components to share data outside of Terraform state. Atmos supports store providers including AWS SSM Parameter Store, AWS Secrets Manager, Azure Key Vault, Google Secret Manager, Redis, and JFrog Artifactory.
When to Use Stores
Use stores when you need to:
- Share data between components that is not managed by Terraform
- Access configuration from external systems (SSM, Azure Key Vault, Redis)
- Integrate with CI/CD pipelines that write to parameter stores
- Store and retrieve Terraform outputs via hooks for faster cross-component reads
- Share state across accounts, regions, or cloud providers
For Terraform-managed outputs, prefer !terraform.state (fastest) or !terraform.output. Use stores for external data or when you need a write-back mechanism via hooks.
Configuring Stores in atmos.yaml
All stores are declared under the top-level stores: key in atmos.yaml. Each store has a unique name, a kind, and provider-specific options. The legacy type field remains supported for compatibility, but kind is canonical:
# atmos.yamlstores:prod/ssm:kind: aws/ssmoptions:region: us-east-1prod/asm:kind: aws/asmoptions:region: us-east-1prod/azure:kind: azure/keyvaultoptions:vault_url: "https://my-keyvault.vault.azure.net/"prod/gcp:kind: gcp/secretmanageroptions:project_id: my-projectcache:type: redisoptions:url: "redis://localhost:6379"artifacts:type: artifactoryoptions:url: https://artifactory.example.comrepo_name: my-repo
Store Naming Convention
Store names follow the pattern <environment>/<type> by convention:
prod/ssm-- Production SSM Parameter Storedev/secrets-- Development secretsshared/config-- Shared configuration store
These names are referenced in !store function calls and hook configurations.
Common Options (All Providers)
All store providers support these optional fields:
prefix-- String prepended to all keys (scopes the store namespace)stack_delimiter-- Character used to split stack names into key path segments (defaults vary by provider)
Identity-Based Authentication
Stores that support identity-based authentication accept an identity field at the store level (not inside options). This connects the store to an Atmos auth identity for credential resolution:
stores:prod/ssm:kind: aws/ssmidentity: prod-aws # References an identity defined in the auth sectionoptions:region: us-east-1
Identity-based auth is supported by AWS SSM, AWS Secrets Manager, Azure Key Vault, and Google Secret Manager. It is not supported by Redis or Artifactory (a warning is logged if configured).
Store Provider Configuration
AWS SSM Parameter Store
stores:prod/ssm:kind: aws/ssmoptions:region: us-east-1 # Requiredprefix: myapp # Optional: prepended to all key pathsstack_delimiter: "/" # Optional: default is "-"read_role_arn: arn:aws:iam::123456789012:role/SSMReader # Optional: cross-account readwrite_role_arn: arn:aws:iam::123456789012:role/SSMWriter # Optional: cross-account write
Authentication uses the AWS default credential chain (environment variables, shared credentials, instance profile). Use read_role_arn/write_role_arn for cross-account access via STS AssumeRole.
Key format: /<prefix>/<stack-parts>/<component-parts>/<key> (segments joined by /).
AWS Secrets Manager
stores:prod/asm:kind: aws/asmoptions:region: us-east-1prefix: myappstack_delimiter: "/"
Use secret: true with kind: aws/asm for declared secrets managed through atmos secret and !secret.
Azure Key Vault
stores:prod/azure:kind: azure/keyvaultoptions:vault_url: "https://my-keyvault.vault.azure.net/" # Requiredprefix: myapp # Optionalstack_delimiter: "-" # Optional: default is "-"
Authentication uses the Azure Default Credential chain (environment variables, managed identity, Azure CLI). Secret names are normalized to comply with Azure Key Vault restrictions: only alphanumeric characters and hyphens are allowed.
Key format: <prefix>-<stack-parts>-<component-parts>-<key> (segments joined by -, non-alphanumeric characters replaced with -).
Google Secret Manager
stores:prod/gcp:kind: gcp/secretmanageroptions:project_id: my-project # Requiredprefix: myapp # Optionalstack_delimiter: "_" # Optional: default is "-"credentials: '{"type":"service_account",...}' # Optional: inline JSON credentialslocations: # Optional: replication locations- us-east1- us-west1
Authentication uses the GCP default credential chain or the GOOGLE_APPLICATION_CREDENTIALS environment variable. Provide credentials inline for service account JSON. If locations is omitted, automatic replication is used.
Key format: <prefix>_<stack-parts>_<component-parts>_<key> (segments joined by _, slashes replaced with _).
Redis
stores:cache:type: redisoptions:url: "redis://localhost:6379" # Required (or set ATMOS_REDIS_URL env var)prefix: myapp # Optionalstack_delimiter: "/" # Optional: default is "/"
The url supports Redis URL format including authentication: redis://:password@host:port/db. If url is not set, the ATMOS_REDIS_URL environment variable is used.
Key format: <prefix>/<stack-parts>/<component-parts>/<key> (segments joined by /). For !store.get, prefix is joined with : separator.
Artifactory
stores:artifacts:type: artifactoryoptions:url: https://artifactory.example.com # Requiredrepo_name: my-repo # Requiredaccess_token: !env ARTIFACTORY_ACCESS_TOKEN # Optional (see auth below)prefix: myapp # Optionalstack_delimiter: "/" # Optional: default is "/"
Authentication uses access_token from options, or falls back to ARTIFACTORY_ACCESS_TOKEN or JFROG_ACCESS_TOKEN environment variables. Set token to "anonymous" for unauthenticated access.
Create a Generic repository type in JFrog Artifactory. Atmos stores data as JSON files, so no specific package type is required.
Key format: <repo_name>/<prefix>/<stack-parts>/<component-parts>/<key> (segments joined by /).
Reading from Stores with YAML Functions
!store -- Component-Aware Access
Reads values following the Atmos stack/component/key naming convention. The store constructs the full key path from the stack name, component name, and key:
vars:# Three-argument form: store + component + key (current stack implied)vpc_id: !store prod/ssm vpc vpc_id# Four-argument form: store + stack + component + keyvpc_id: !store prod/ssm plat-ue2-prod vpc vpc_id# Dynamic stack reference using Go templatesvpc_id: !store prod/ssm {{ .stack }} vpc vpc_id# With default value for cold-start scenariosapi_key: !store prod/ssm config api_key | default "not-set"# With YQ query to extract nested datadb_host: !store prod/ssm database config | query .host# Extract from listfirst_subnet: !store prod/ssm vpc subnet_ids | query .[0]
Dynamic stack construction using printf:
vars:# Cross-tenant referencevpc_id: !store prod/ssm {{ printf "net-%s-%s" .vars.environment .vars.stage }} vpc vpc_id# Full context-based stack nameconfig: !store prod/ssm {{ printf "%s-%s-%s" .vars.tenant .vars.environment .vars.stage }} config settings
!store.get -- Arbitrary Key Access
Reads arbitrary keys directly from a store without the stack/component/key convention. Use this for values written by external systems or global configuration:
vars:# Direct key accessdb_password: !store.get prod/ssm /myapp/prod/db/password# With default valuefeature_flag: !store.get prod/ssm /features/new-feature | default "disabled"# With YQ queryapi_key: !store.get cache app-config | query .api.key# Dynamic key with templatesconfig: !store.get cache "config-{{ .vars.region }}"
Key differences between !store and !store.get:
| Feature | !store | !store.get |
|---|---|---|
| Key construction | Builds from stack/component/key | Uses exact key as provided |
| Use case | Atmos-managed component outputs | External systems, global config |
| Typical pattern | prefix/stack/component/key | Any format the store supports |
atmos.Store -- Go Template Access
Read from stores within Go template expressions:
vars:vpc_id: '{{ atmos.Store "prod/ssm" .stack "vpc" "vpc_id" }}'config: !template '{{ (atmos.Store "cache" .stack "config" "config_map").defaults | toJSON }}'
Writing to Stores with Hooks
Hooks write Terraform outputs to stores after atmos terraform apply or atmos terraform deploy. Configure hooks at any level (global, terraform-level, component-level) and Atmos deep-merges them:
# Full hook definition on a componentcomponents:terraform:vpc:hooks:store-outputs:events:- after-terraform-applycommand: storename: prod/ssmoutputs:vpc_id: .vpc_idprivate_subnet_ids: .private_subnet_idspublic_subnet_ids: .public_subnet_ids
Output values starting with . reference Terraform output names. The hook retrieves these from the Terraform state and writes them to the configured store.
DRY Hook Configuration (Layered)
Split hook configuration across inheritance levels to avoid repetition:
# stacks/catalog/vpc/_defaults.yaml -- global levelhooks:store-outputs:events:- after-terraform-applycommand: store# stacks/orgs/acme/plat/prod/_defaults.yaml -- account levelterraform:hooks:store-outputs:name: prod/ssm# stacks/orgs/acme/plat/prod/us-east-2.yaml -- component levelcomponents:terraform:vpc:hooks:store-outputs:outputs:vpc_id: .vpc_id
Atmos merges these into a complete hook definition at resolution time.
Write to Stores with the CLI or a Workflow Step
For raw CRUD access to any configured store, use the atmos store CLI command family or the
type: store workflow step. This access works for any store, not only Terraform outputs. Neither
method requires a declaration. Both operate directly on any store configured under stores:, by
name.
# CLI: set, get, delete, list -- scope to a stack and component, or omit for a global valueatmos store set app-metadata image_tag sha256:abc123 --stack=prod --component=ecs-serviceatmos store get app-metadata image_tag --stack=prod --component=ecs-serviceatmos store listatmos store list app-metadata --stack=prod --component=ecs-service
Passing a store name to atmos store list lists the key/value pairs stored under a scope
(instead of the configured backends themselves), for backends that support key enumeration. Most
backends support it. 1Password and the default system keychain backend do not, because their
underlying APIs do not support enumeration. Check the Listable column in a bare
atmos store list before relying on it for a given store. Values are masked the same way
atmos store get masks a single value.
# Workflow, custom-command, or hook step: write a value, for example an image tag from a build step- name: record-tagtype: storeaction: writewith:store: app-metadatakey: image_tagvalue: "{{ .steps.push.metadata.digest }}"stack: prodcomponent: ecs-service
Atmos allows you to write to a secret: true store this way, for example to write a generated
password. But this write skips the atmos secret declaration and scope system. When a value must
be tracked as a formal secret, use secrets.vars and atmos secret set instead. See the
atmos-secrets skill for that system. See the atmos-steps skill and the
/workflows/steps/type/store docs for the step type.
Cross-Account and Cross-Region Access
AWS Cross-Account via Role Assumption
stores:prod/ssm:kind: aws/ssmoptions:region: us-east-1read_role_arn: arn:aws:iam::123456789012:role/SSMReaderwrite_role_arn: arn:aws:iam::123456789012:role/SSMWriter
Atmos uses STS AssumeRole to obtain temporary credentials for the target account. Separate read and write roles allow least-privilege access.
Multi-Region Configuration
Define separate stores per region:
stores:prod-us/ssm:kind: aws/ssmoptions:region: us-east-1prod-eu/ssm:kind: aws/ssmoptions:region: eu-west-1
Reference the appropriate store in each stack's configuration.
End-to-End Example: VPC to EKS
- Configure the store in
atmos.yaml:
stores:prod/ssm:kind: aws/ssmoptions:region: us-east-1
- Set up hooks on VPC to write outputs after apply:
# stacks/catalog/vpc/_defaults.yamlhooks:store-outputs:events:- after-terraform-applycommand: storename: prod/ssmoutputs:vpc_id: .vpc_idprivate_subnet_ids: .private_subnet_ids
- Read stored values in EKS component:
# stacks/prod/us-east-1.yamlcomponents:terraform:eks:vars:vpc_id: !store prod/ssm vpc vpc_idsubnet_ids: !store prod/ssm vpc private_subnet_ids
Security Best Practices
- Secrets exposure:
!store,!store.get, andatmos.Storeread values in cleartext and reject stores markedsecret: true. Usesecret: trueplus!secretandatmos secretfor sensitive values. - Least privilege: Use
read_role_arn/write_role_arnto separate read and write permissions. Grant only the permissions each operation needs. - Environment variables for tokens: Never hardcode access tokens. Use
!envor environment variables (ARTIFACTORY_ACCESS_TOKEN,JFROG_ACCESS_TOKEN,ATMOS_REDIS_URL). - Cold-start handling: Always provide
| defaultvalues for store lookups that may reference unprovisioned components. - DR implications: Be cautious with cross-region store references. If a region goes down, stores in that region become unavailable.
- Permission scoping: When using
atmos describe affectedwith!storereferences, Atmos needs read access to all referenced stores. Limited permissions (e.g., dev-only) will cause failures when referencing production stores.
Troubleshooting
| Problem | Cause | Solution |
|---|---|---|
store type not found | Invalid kind/type in store config | Use one of: aws/ssm, aws/asm, azure/keyvault, gcp/secretmanager, redis, artifactory |
region is required | Missing region for SSM store | Add region to store options |
vault_url is required | Missing vault_url for Azure | Add vault_url to store options |
project_id is required | Missing project_id for GCP | Add project_id to store options |
failed to parse redis url | Invalid Redis URL format | Use format redis://:password@host:port/db |
access_token must be set | Missing Artifactory token | Set access_token in options or ARTIFACTORY_ACCESS_TOKEN env var |
| Key not found errors | Component not yet provisioned | Add a default fallback value to the !store call |
| Permission denied | Insufficient IAM/RBAC permissions | Check role ARNs, vault policies, or service account permissions |
| Identity warning logged | Identity set on unsupported provider | Remove identity from Redis and Artifactory stores |
Reference
For detailed provider configuration, authentication patterns, and advanced hook integration, see references/store-providers.md.