Skip to content

Templating

The templating engine is powered by Go Templates. You can use any normal Go template operator within your template strings.

Fields

Common Fields

These fields are available to all templates, everywhere. Note they must be wrapped in double curly braces.

Key Description
.Project the project name
.Env.VARNAME a Map with all the current environment variables
.Date current UTC date in RFC 3339 format
.Timestamp current UTC time in Unix format
.AppVersion the value you provided to --app-version (if you provided it)
.Version an alias for .AppVersion
.ImageTag the value you provided to --tag
.Tag alias for .ImageTag
.Image the value you provided to --image (a container image URI)
.Cluster the name of the ECS Cluster the app will be deployed on
.Stage the stage name for the application (i.e. "production", "staging", etc). You can specify this with stage: VALUE in the config file.

IMPORTANT: Specifying a stage in your file WILL modify the naming conventions for your application. If you have already deployed, do not add this.
See Naming to see how this will change the names of resources.
AwsAccountId numeric AWS Account number (note the lack of . at the start)
AwsRegion current AWS region (note the lack of . at the start)

The following sections denote fields that are only available in certain contexts.

These are only available within sections related to individual tasks (CronJobs, PreDeploy, Services).

Key Description
.Arch The architecture of the task. amd64 or arm64
.Name the task name you are referencing
.Container the name of the individual container (will be the same as .Name for the primary container)

Functions

For all fields, you can use the following functions:

Usage Description
join "sep" "x" "y" "z" concatenates the 2nd thru last parameter using the 1st as a separator
prefix "value" 4 only returns the first N characters of a string
replace "v1.2" "v" "" replaces all matches. See ReplaceAll
split "1.2" "." split string at separator. See Split
time "01/02/2006" current UTC time in the specified format (this is not deterministic, a new time will be returned for every call)
tolower "V1.2" makes input string lowercase. See ToLower
toupper "v1.2" makes input string uppercase. See ToUpper
trim " v1.2 " removes all leading and trailing white space. See TrimSpace
trimprefix "v1.2" "v" removes provided leading prefix string, if present. See TrimPrefix
trimsuffix "1.2v" "v" removes provided trailing suffix string, if present. See TrimSuffix