Update:
Not sure when this happened, but this works as is described now.
As well as an option in the Pipeline build action to set the secret directly.
Original Question:
I have an environment variable set for the secret-id
set inside the build phase of a AWS CodePipeline. eg. $SECRET_ID
.
I want to use it in the CodeBuild buildspec.yml to get a set of secrets from the Secrets Manager based on my environment. Is it possible to self-reference other variables in a buildspec file?
This is how I would have anticipated it would work, but it doesn't.
version: 0.2
env:
secrets-manager:
MY_SECRET: ${SECRET_ID}
phases:
build:
commands:
- echo $MY_SECRET
I receive the following error in the build logs.
Secrets Manager Error Message: ValidationException: Invalid name. Must be a valid name containing alphanumeric characters, or any of the following: -/_+=.@!