I am running the below awscli command in a bash script through teamcity step
#!/bin/bash
repo=%env.RepoName%
echo "repo is ${repo}"
tags=%env.Tags%
echo "tags are ${tags}"
aws ecr create-repository --repository-name ${repo} --tags '${tags}'
where %env.RepoName% and %env.Tags% are teamcity variables with values sample-repo and [{"Key":"env","Value":"dev"},{"Key":"dept","Value":"finance"}] respectively. However when the aws cli command runs it errors out with the below error
Expecting property name enclosed in double quotes: line 1 column 3 (char 2)
However if i pass in the value of %env.Tags% as '[{"Key":"env","Value":"dev"},{"Key":"dept","Value":"finance"}]' with the single quotes and exclude the '' from the tags property in the aws cli command it runs without issues.
What is that I am missing and is there a recommended way to fix this?