Description
When Architectures is set in Globals.Function and also set on an individual AWS::Serverless::Function, SAM merges the two lists by concatenating them. This produces an invalid Lambda Architectures value because Lambda functions support only one architecture value.
This is inconsistent with scalar function properties like MemorySize, where the resource-level value overrides the global value.
Steps to reproduce
Use a SAM template with Architectures set globally and overridden by a function:
AWSTemplateFormatVersion: "2010-09-09"
Transform: AWS::Serverless-2016-10-31
Globals:
Function:
Runtime: nodejs20.x
Handler: index.handler
CodeUri: src/
Architectures:
- x86_64
Resources:
MyFunction:
Type: AWS::Serverless::Function
Properties:
Architectures:
- arm64
Observed result
The resource-level Architectures value is merged with the global value as a list, producing both architectures:
Architectures:
- x86_64
- arm64
This follows the generic Globals list merge behavior, but it is not valid for Lambda function architectures.
Expected result
The resource-level Architectures value should override the global value, the same way resource-level primitive properties like MemorySize override Globals.Function.MemorySize.
Expected transformed value:
Additional environment details
- OS: Any
- If using the SAM CLI,
sam --version: Not using SAM CLI directly; observed in SAM Translator behavior
- AWS region: N/A
Description
When
Architecturesis set inGlobals.Functionand also set on an individualAWS::Serverless::Function, SAM merges the two lists by concatenating them. This produces an invalid LambdaArchitecturesvalue because Lambda functions support only one architecture value.This is inconsistent with scalar function properties like
MemorySize, where the resource-level value overrides the global value.Steps to reproduce
Use a SAM template with
Architecturesset globally and overridden by a function:Observed result
The resource-level Architectures value is merged with the global value as a list, producing both architectures:
This follows the generic Globals list merge behavior, but it is not valid for Lambda function architectures.
Expected result
The resource-level Architectures value should override the global value, the same way resource-level primitive properties like MemorySize override Globals.Function.MemorySize.
Expected transformed value:
Additional environment details
sam --version: Not using SAM CLI directly; observed in SAM Translator behavior