Closed wayne-folkes closed 2 years ago
Hey @wayne-folkes, Thanks for the feedback. SAM transform is a CloudFormation Macro which runs before resolving any other resources. SAM does not have insight into custom modules and its resources. Closing as this is a limitation with CloudFormation template resolving order. Let me know if there are other issues and I'll reopen this.
Description:
When using a CF module in a SAM template the Runtime value specified in the
Globals
section but not in theAWS::Serverless::Function
resource the value appears to be ignored when attempting to deploy and will cause an error to be thrown.Steps to reproduce:
AWS::Serverless::Function
resource and attempt to deployResources: Function: Type: AWS::Serverless::Function Properties: CodeUri: hello_world/ Handler: app.lambda_handler
MyModule: Type: 'My::Lambda::ALBFunction::MODULE' Properties: VpcId: !ImportValue my-vpc-id SecurityGroupId: !ImportValue my-vpc-sg-id SubnetIds: !ImportValue my-vpc-private-subnet-ids CertificateArn: !ImportValue my-wildcard-cert-arn FunctionArn: !GetAtt Function.Arn HostedZoneId: !ImportValue my-HostedZoneId HostName: !Sub
Observed result:
Expected result:
The stack should deploy. To get around this issue I have to add the
Runtime
property to the Function.If the module is removed from the template the function will deploy as expected when the Runtime value is only specified in the Globals section
Additional environment details (Ex: Windows, Mac, Amazon Linux etc)
sam --version
: SAM CLI, version 1.37.0Add --debug flag to any SAM CLI commands you are running