Skip to Content
ConfigurationVariables

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

AttributeTypeDescription
secretboolIf true, value is masked in CLI output
defaultanyDefault 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-app

Values 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

  1. Value set via squadron vars set (encrypted in .squadron/vars.vault)
  2. Default value from variable block
  3. 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" { } # Avoid
Last updated on