Skip to content

Globals.Function Architectures should be overridden by resource-level Architectures #3939

@allenheltondev

Description

@allenheltondev

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:

Architectures:
  - arm64

Additional environment details

  1. OS: Any
  2. If using the SAM CLI, sam --version: Not using SAM CLI directly; observed in SAM Translator behavior
  3. AWS region: N/A

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions