CFN Dynamic Reference to SSM param and Intrinsic Functions not working with templated InvokeTarget
- Dominant language
- TypeScript
- Stars
- 2k
- Forks
- 807
- Avg merge
- 10h 12m
- Merged PRs (30d)
- 7
Description
## Problem
For debugging lambda functions in VSCode through the AWS SAM template, I'm using a direct-invoke with an invoke target of type Template ( https://docs.aws.amazon.com/toolkit-for-vscode/latest/userguide/serverless-apps-run-debug-config-ref.html ) which includes a reference to a SAM template and the logical ID in that template.
The template transform does not process Dynamic References ( https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/dynamic-references.html ) and also does not allow those references in intrinsic functions, like Fn:Sub.
Let's say I have a SSM parameter:
Key: /staging/cloudformation/lambda-layer/arn
Value: some:arn:example
I also have a template parameter "Bar" which is set to "staging"
!Sub "FOO {{resolve:ssm:/${Bar}/cloudformation/lambda-layer/arn}}"
In CFN will resolve to "FOO some:arn:example"
In this toolkit it resolves to : "FOO {{resolve:ssm:/Bar/cloudformation/lambda-layer/arn}}"
Removing the Fn:Sub and just leaving it: "{{resolve:ssm:/staging/cloudformation/lambda-layer/arn}}"
Still only resolves to: "{{resolve:ssm:/staging/cloudformation/lambda-layer/arn}}"
So, it's neither executing the intrinsic function inside the reference or resolving the SSM parameter
## Steps to reproduce the issue
1. Create an SSM parameter
2. Create a new templated SAM Function that prints an environment variable
3. Set the environment variable in the template to reference this SSM parameter, through a Fn:Sub intrinsic function
4. Create a launch config to call the above SAM Template
5. Debug the launch config
## Expected behavior
CFN processes the intrinsic function and then resolve the dynamic reference
## System details (run the `AWS: About Toolkit` command)
- OS: Windows 10
- Visual Studio Code version: 1.75.1
- AWS Toolkit version: 1.62.0
Contributor guide
Research direction
Start with the templated InvokeTarget launch configuration and reproduce the SAM debugging case using an SSM dynamic reference inside Fn::Sub. Compare the toolkit result with CloudFormation's expected processing, and consider the issue done when intrinsic functions and dynamic references resolve correctly during the debug launch.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, typescript, vscode
- Domain
- cloud, devtools, infrastructure
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100