HCL variables in waypoint.hcl

Does waypoint.hcl support variables? The reason I’m asking is that I’d like to be able to set the docker image tag based on external data like my branch, ci/cd build number, git hash, etc. For example:

project = "waypoint-test"

app "waypoint-test" {

  build {
    use "docker" {}

    registry {
      use "aws-ecr" {
        region     = "us-east-1"
        repository = "waypoint-test"
        tag        =  var.tag
      }
    }
  }
}

It doesn’t support them yet, no. You can use functions for a subset of that, like gitrefpretty() to get a reference to the current git context, or escape entirely and use file() to read the tag from a file, perhaps written by your CI process.

Thank you @evanphx! Do you know if there is a listing of those built-in functions someplace?

We absolutely need to pull these out into the docs, we’ll get that sorted very soon. In the mean time, they’re defined in here, you can click through the files and see them being defined: https://github.com/hashicorp/waypoint/tree/main/internal/config/funcs

1 Like