Bug: Fn::If not supported, unsure of a workaround when working with Lambda layers #7509
Labels
area/local
blocked/close-if-inactive
Blocked for >14 days with no response, will be closed if still inactive after 7 days
type/question
Description:
In one project, I'm outputting a Lambda layer:
In a separate project, I want to import this layer:
This works in production, but not locally because
Fn::ImportValue
doesn't work locally. The standard workaround is to use Conditions on a parameter that is overridden on local runs:But this doesn't work because
Fn::If
isn't supported either. Users have run into similar issues where the recommended workaround was to instead define a parameter for the value itself, which is overridden on local runs. Applied to my case, that would be something like:However, this doesn't work because
Every Default member must be a string
, so it seems you can't use intrinsic functions in the default values of parameters.Observed result:
Expected result:
Expect to be able to
!ImportValue
a Lambda layer ARN in production, and override it with a hardcoded ARN in local environment.Additional environment details (Ex: Windows, Mac, Amazon Linux etc)
sam --version
: SAM CLI, version 1.118.0The text was updated successfully, but these errors were encountered: