From 97038e04363abcf4156d5a7e2968efa8fccc9368 Mon Sep 17 00:00:00 2001 From: jeffhiltz Date: Thu, 12 Feb 2026 10:21:23 -0500 Subject: [PATCH] add architectures property to lambda shortcuts --- changelog.md | 8 ++++++++ lib/shortcuts/api.md | 1 + lib/shortcuts/lambda.js | 3 +++ package-lock.json | 4 ++-- package.json | 2 +- test/fixtures/shortcuts/lambda-full.json | 3 +++ test/shortcuts.test.js | 1 + 7 files changed, 19 insertions(+), 3 deletions(-) diff --git a/changelog.md b/changelog.md index 741e296..0271069 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,13 @@ # Changelog +## 9.4.0 + +- Add support for `Architectures` property to Lambda shortcuts. + +## 9.3.2 + +- Dependency update to avoid security vulnerabilities (@aws-sdk/client-cloudformation). + ## 9.3.1 - Add `GlueIcebergTable` shortcut for creating AWS Glue tables backed by Apache Iceberg format with support for table optimizers. diff --git a/lib/shortcuts/api.md b/lib/shortcuts/api.md index 9d8c661..b1291c8 100644 --- a/lib/shortcuts/api.md +++ b/lib/shortcuts/api.md @@ -428,6 +428,7 @@ Log Group, a Role, an Alarm on function errors, and the Lambda Function itself. | options | Object | | Options. | | options.LogicalName | String | | The logical name of the Lambda function within the CloudFormation template. This is used to construct the logical names of the other resources, as well as the Lambda function's name. | | options.Code | Object | | See [AWS documentation](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lambda-function-code.html). | +| [options.Architectures] | Array.<String> | | See [AWS documentation](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-function.html#cfn-lambda-function-architectures). | | [options.ImageConfig] | Object | | See [AWS documentation](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-function.html#cfn-lambda-function-imageconfig). | | [options.DeadLetterConfig] | Object | | See [AWS documentation](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-function.html#cfn-lambda-function-deadletterconfig). | | [options.Description] | String | '${logical name} in the ${stack name} stack' | See [AWS documentation](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-function.html#cfn-lambda-function-description). | diff --git a/lib/shortcuts/lambda.js b/lib/shortcuts/lambda.js index 9153296..04c8edd 100644 --- a/lib/shortcuts/lambda.js +++ b/lib/shortcuts/lambda.js @@ -12,6 +12,7 @@ const ServiceRole = require('./service-role'); * within the CloudFormation template. This is used to construct the logical * names of the other resources, as well as the Lambda function's name. * @param {Object} options.Code - See [AWS documentation](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lambda-function-code.html). + * @param {Array} [options.Architectures=undefined] - See [AWS documentation](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-function.html#cfn-lambda-function-architectures). * @param {Object} [options.ImageConfig=undefined] - See [AWS documentation](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-function.html#cfn-lambda-function-imageconfig). * @param {Object} [options.DeadLetterConfig=undefined] - See [AWS documentation](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-function.html#cfn-lambda-function-deadletterconfig). * @param {String} [options.Description='${logical name} in the ${stack name} stack'] - See [AWS documentation](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-function.html#cfn-lambda-function-description). @@ -72,6 +73,7 @@ class Lambda { const { LogicalName, Code, + Architectures, ImageConfig, DeadLetterConfig, Description = { 'Fn::Sub': `${LogicalName} in the \${AWS::StackName} stack` }, @@ -155,6 +157,7 @@ class Lambda { DependsOn, Properties: { Code, + Architectures, ImageConfig, DeadLetterConfig, Description, diff --git a/package-lock.json b/package-lock.json index 056f982..8a038f4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@mapbox/cloudfriend", - "version": "9.3.2", + "version": "9.4.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@mapbox/cloudfriend", - "version": "9.3.2", + "version": "9.4.0", "license": "ISC", "dependencies": { "@aws-sdk/client-cloudformation": "^3.985.0", diff --git a/package.json b/package.json index 13fd325..7a7bfce 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@mapbox/cloudfriend", - "version": "9.3.2", + "version": "9.4.0", "description": "Helper functions for assembling CloudFormation templates in JavaScript", "main": "index.js", "engines": { diff --git a/test/fixtures/shortcuts/lambda-full.json b/test/fixtures/shortcuts/lambda-full.json index d0ad70d..1b3f316 100644 --- a/test/fixtures/shortcuts/lambda-full.json +++ b/test/fixtures/shortcuts/lambda-full.json @@ -40,6 +40,9 @@ "S3Bucket": "my-code-bucket", "S3Key": "path/to/code.zip" }, + "Architectures": [ + "arm64" + ], "DeadLetterConfig": { "TargetArn": "arn:aws:sqs:us-east-1:123456789012:queue/fake" }, diff --git a/test/shortcuts.test.js b/test/shortcuts.test.js index c32b057..290b618 100644 --- a/test/shortcuts.test.js +++ b/test/shortcuts.test.js @@ -145,6 +145,7 @@ describe('[shortcuts] lambda', () => { S3Bucket: 'my-code-bucket', S3Key: 'path/to/code.zip' }, + Architectures: ['arm64'], DeadLetterConfig: { TargetArn: 'arn:aws:sqs:us-east-1:123456789012:queue/fake' },