serverless / serverless/serverless

Refer to auto-generated resources in CloudFormation

Open
#5,202 2 comments 5 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

cat/variable enhancement
Dominant language
JavaScript
Stars
46.9k
Forks
5.7k
Avg merge
10h 7m
Merged PRs (30d)
57

Description

In some cases, when I add Resources to serverless.yml, I need to refer to resources which are auto-generated by the serverless framework (e.g., in a "DependsOn" clause). See specific example at the bottom.

Currently, the documentation [1] suggests generating the Cloud Formation template, and looking it up there.

It could be great if I could use some sort of built-in function(s) to refer to an auto-generated resource. Or at least the normalized name (which I then could use to construct the full resource name, following the naming convention specified in [1]).

[1] https://serverless.com/framework/docs/providers/aws/guide/resources/

Additional Data

  • Serverless Framework Version you're using: 1.27.3

Added by maintainers

For this specific case, we may solve it via adding support for ${sls.resolveFunctionLogicalId(functionName)}.

Still we need to be careful, as variables resolution happens at very early stage, so we can support only straightfoward resolution which can be done in 100% bulletproof way just by reading the config

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue points to serverless.yml, the generated CloudFormation template, and the AWS resources documentation; start by reviewing how auto-generated resource names are exposed during variable resolution. Done means a supported way to reference an auto-generated resource, or its normalized name, is documented and handles the stated DependsOn use case.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, javascript
Domain
cloud, infrastructure
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.