serverless / serverless/examples
How to reference variable from environment variable and fallback to default value as a ref one?
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 11.5k
- Forks
- 4.4k
- Avg merge
- 2h 55m
- Merged PRs (30d)
- 3
Description
Provider: AWS
I have the following resource in serverless.yml
resources:
Resources:
MyQueue:
Type: AWS::SQS::Queue
Properties:
QueueName:${self:provider.stage}_my_queue
What I need to do is to reference an environment variable from .env file and fallback to ref MyQueue if .env file is missing that key.
referencing a resource is like this
MY_QUEUE: { Ref: MyQueue }
how we can do it like this
MY_QUEUE: ${env:MY_QUEUE, {Ref: MyQueue} } # this not valid one
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Begin with the serverless.yml variable expression and the .env lookup described in the issue, then examine how AWS CloudFormation Ref values are represented in Serverless configuration. Done means establishing whether a supported fallback syntax exists and, if this repository should demonstrate it, documenting the working example.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws
- Domain
- cloud
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100