'Variables/parameters not rendering Azure DevOps

When using variables/parameters in a job involving a container, variable rendering is inconsistent:

parameters:
- name: workingDirectory
  type: string
  default: "terraform"
- name: currentDirectory
  type: string
  default: "$(Build.Repository.LocalPath)"

container:
      image: aquasec/tfsec:latest
      options: --rm -v "${{ parameters.currentDirectory }}/${{ parameters.workingDirectory }}:/src"

Output:

Error response from daemon: create > $(Build.Repository.LocalPath)/terraform: > "$(Build.Repository.LocalPath)/sample/terraform" includes invalid > characters for a local volume name

I've tried variables:, parameters:, straight up bash $(pwd), with/without quotes. Doesn't seem to make a difference. Everything before the / is rendered as-is, whereas the workingDirectory parameters just works.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source