Variables
Variables store configuration values that can be referenced throughout your HCL files.
Defining Variables
variable "api_key" {
secret = true # Mask value in output
}
variable "app_name" {
default = "myapp" # Optional default value
}
variable "max_retries" {
default = 3
}Attributes
| Attribute | Type | Description |
|---|---|---|
secret | bool | If true, value is masked in CLI output |
default | any | Default value if not set via squadron vars set |
Setting Values
Use the CLI to set variable values:
squadron vars set api_key sk-ant-...
squadron vars set app_name production-appValues are encrypted at rest in .squadron/vars.vault. The vault is initialized automatically the first time you run squadron engage.
Referencing Variables
Use vars.name to reference a variable:
model "anthropic" {
api_key = vars.api_key
}
agent "assistant" {
personality = "Assistant for ${vars.app_name}"
}Resolution Order
- Value set via
squadron vars set(encrypted in.squadron/vars.vault) - Default value from
variableblock - Error if neither exists
Best Practices
Secrets
Always mark sensitive values as secrets:
variable "anthropic_api_key" {
secret = true
}
variable "database_password" {
secret = true
}Defaults for Non-Sensitive Values
Provide defaults for convenience:
variable "environment" {
default = "development"
}
variable "log_level" {
default = "info"
}Naming Convention
Use snake_case for variable names:
variable "anthropic_api_key" { } # Good
variable "anthropicApiKey" { } # AvoidLast updated on