Create one or more Environment Manager environment variables.
This command is only available on Astro.
Create a single environment variable with --key and --value, or bulk-create variables from a dotenv file with --from-file. When you use --from-file, the --secret and --auto-link flags apply to every entry in the file.
Usage
astro env variable create
Options
Option
Description
Possible Values
-k,--key
The variable key. Required unless you use --from-file.
Any string
-v,--value
The variable value. If omitted, the CLI reads the value from stdin when piped, or prompts for it with the input hidden.
Any string
-s,--secret
Mark the variable as secret.
None
--from-file
Bulk-create variables from a dotenv file with one KEY=VALUE per line. Pass - to read from stdin. Mutually exclusive with --key and --value.
Any valid file path, or -
--auto-link
Workspace scope only. Automatically link the variable to all Deployments in the Workspace, including future ones.
None
--workspace-id
Set the Workspace scope. Mutually exclusive with --deployment-id. Defaults to your current Workspace from CLI context.
Any valid Workspace ID
--deployment-id
Set the Deployment scope. Mutually exclusive with --workspace-id.
Any valid Deployment ID
Examples
# Create a Workspace variableastro env variable create --workspace-id <workspace-id> --key DBT_PROFILES_DIR --value /opt/profiles# Create a secret Workspace variable and auto-link it to every Deploymentastro env variable create --workspace-id <workspace-id> --key API_TOKEN --value $TOKEN --secret --auto-link# Bulk-create variables from a dotenv fileastro env variable create --workspace-id <workspace-id> --from-file .env