Bug: AWS::Serverless::Function ImageUri with function (ex: using !If) fails with type error #7270
Labels
area/build
sam build command
stage/waiting-for-release
Fix has been merged to develop and is waiting for a release
Description:
This looks very similar to issue #7117 (fixed in 1.117) but was found on 1.120 and is with !If rather than !Sub.
Setting an ImageUri in an AWS::Serverless::Function with Metadata to an !If results in the following error when running
sam build
:Steps to reproduce:
Set up an AWS::Serverless::Function with an ImageUri that uses Fn::If to reproduce - note that the function must have Metadata defined for the error to occur.
Here's a minimal example:
Note that if you comment out the Metadata block it all works fine.
I realise that having both the ImageUri and the Metadata defined may be an odd combination. It allows me to use a single template for an existing build system that I'm migrating away from, as well as local usage with sam.
The detailed log contains a lot of information that I don't want to paste in here, but if you run the minimal repro script above you'll see the line:
Unable to resolve property ImageUri: OrderedDict([('Fn::If', ['LambdaImageUnset', {'Ref': 'AWS::NoValue'}, {'Ref': 'LambdaImage'}])]). Leaving as is.
Expected result:
Correct evaluation of Fn::If
Additional environment details (Ex: Windows, Mac, Amazon Linux etc)
The text was updated successfully, but these errors were encountered: