sam build fails when providing a function LayerArn with a reference to a SSM::Parameter CF param
See original GitHub issueDescription
When running sam build
on a template that includes a Serverless::Function
resource that specifies a LayerArn
property with a reference to a CF Parameter
name that is of Type AWS::SSM::Parameter<string>
with a default value of the name of the param in param store, sam build
reports an invalid Arn.
Steps to reproduce
git clone https://github.com/ericallam/sam-build-ssm-parameter-layer-arn-issue.git
cd sam-build-ssm-parameter-layer-arn-issue
sam build --debug
Observed result
View debug output here
Expected result
sam build
should resolve the actual value of the param in param store and use that to determine if the LayerArn is valid.
Additional environment details (Ex: Windows, Mac, Amazon Linux etc)
- OS: macOS Mojave
sam --version
: 0.13.0
Issue Analytics
- State:
- Created 5 years ago
- Reactions:14
- Comments:35 (8 by maintainers)
Top Results From Across the Web
sam build fails when providing a function LayerArn with a ...
When running sam build on a template that includes a Serverless::Function resource that specifies a LayerArn property with a reference to a ...
Read more >Invalid Layer Arn Error when using ARN value from SSM ...
It seems, SAM doesn't resolve SSM parameters. Please try using --parameter-overrides option. Example: sam build --parameter-overrides ...
Read more >terraform-aws-modules/lambda/aws
Terraform module, which takes care of a lot of AWS Lambda/serverless tasks (build dependencies, packages, updates, deployments) in countless ...
Read more >Invoking AWS Lambda functions locally using AWS SAM CLI
Learn how to invoke AWS Lambda functions on your machine using AWS SAM CLI. ... The AWS Serverless Application Model extends AWS CloudFormation...
Read more >Invalid Layer Arn Error When Using Arn Value From ... - ADocLib
Reference Variables using the SSM Parameter Store. ... If you provide a RESOURCELOGICALID then AWS SAM builds only that resource.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I get that using
--parameter-overrides
works, but it’s a really non-intuitive way to need to getsam build
to work when we want to pass anyAWS::SSM
parameter types.This is exactly how it should behave if the
Ref
is anAWS::SSM::*
parameter. I would imagine a reasonable person wouldn’t expect the parameter value be resolved at build time. Or at the very least, ifsam build
detects this type of parameter, it should output some kind of warning about needing to use a--parameter-override
to pass the validation.Otherwise, one has to search Github issues to find this solution.
For clarity for anyone else fighting this bug the following literally got me working:
sam build --parameter-overrides param1=arn:::::::1 param2=arn:::::::1