diff --git a/cloudformation/global/function.go b/cloudformation/global/function.go index 2e7edfdb73..c54ac1a7ed 100644 --- a/cloudformation/global/function.go +++ b/cloudformation/global/function.go @@ -8,6 +8,11 @@ import ( // See: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#awsserverlessfunction type Function struct { + // Architectures AWS CloudFormation Property + // Required: false + // See: https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/sam-resource-function.html#sam-function-architectures + Architectures []string `json:"Architectures,omitempty"` + // AssumeRolePolicyDocument AWS CloudFormation Property // Required: false // See: https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/sam-resource-function.html#sam-function-assumerolepolicydocument diff --git a/cloudformation/serverless/aws-serverless-function.go b/cloudformation/serverless/aws-serverless-function.go index 451209a5f6..e2d1fcebd0 100644 --- a/cloudformation/serverless/aws-serverless-function.go +++ b/cloudformation/serverless/aws-serverless-function.go @@ -12,6 +12,11 @@ import ( // See: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#awsserverlessfunction type Function struct { + // Architectures AWS CloudFormation Property + // Required: false + // See: https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/sam-resource-function.html#sam-function-architectures + Architectures []string `json:"Architectures,omitempty"` + // AssumeRolePolicyDocument AWS CloudFormation Property // Required: false // See: https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/sam-resource-function.html#sam-function-assumerolepolicydocument diff --git a/generate/sam-2016-10-31.json b/generate/sam-2016-10-31.json index ae577637e4..2b65e7500b 100644 --- a/generate/sam-2016-10-31.json +++ b/generate/sam-2016-10-31.json @@ -257,6 +257,13 @@ "Required": false, "PrimitiveType": "String", "UpdateType": "Immutable" + }, + "Architectures": { + "Documentation": "https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/sam-resource-function.html#sam-function-architectures", + "Required": false, + "Type": "List", + "ItemType": "String", + "UpdateType": "Immutable" } } }, diff --git a/goformation_test.go b/goformation_test.go index 846638d022..ae4e9a71b2 100644 --- a/goformation_test.go +++ b/goformation_test.go @@ -1449,5 +1449,42 @@ var _ = Describe("Goformation", func() { Expect(string(got)).To(Equal(expected)) }) }) + + Context("that has an image in arm64 architecture", func() { + template := cloudformation.NewTemplate() + transform := "AWS::Serverless-2016-10-31" + template.Transform = &cloudformation.Transform{ + String: &transform, + } + template.Resources["TestFunction"] = &serverless.Function{ + Architectures: []string{"arm64"}, + ImageUri: "image:latest-arm64", + } + + expected := `{ + "AWSTemplateFormatVersion": "2010-09-09", + "Resources": { + "TestFunction": { + "Properties": { + "Architectures": [ + "arm64" + ], + "ImageUri": "image:latest-arm64" + }, + "Type": "AWS::Serverless::Function" + } + }, + "Transform": "AWS::Serverless-2016-10-31" +}` + + got, err := template.JSON() + It("should marshal template successfully", func() { + Expect(err).To(BeNil()) + }) + + It("should be equal to expected output", func() { + Expect(string(got)).To(Equal(expected)) + }) + }) }) }) diff --git a/schema/sam.go b/schema/sam.go index 7b43d9e301..cbc7bcb111 100644 --- a/schema/sam.go +++ b/schema/sam.go @@ -115596,6 +115596,12 @@ var SamSchema = `{ "Properties": { "additionalProperties": false, "properties": { + "Architectures": { + "items": { + "type": "string" + }, + "type": "array" + }, "AssumeRolePolicyDocument": { "type": "object" }, @@ -125865,6 +125871,12 @@ var SamSchema = `{ }, "Function": { "properties": { + "Architectures": { + "items": { + "type": "string" + }, + "type": "array" + }, "AssumeRolePolicyDocument": { "type": "object" }, diff --git a/schema/sam.schema.json b/schema/sam.schema.json index ba6b893c9f..221cffd826 100644 --- a/schema/sam.schema.json +++ b/schema/sam.schema.json @@ -115593,6 +115593,12 @@ "Properties": { "additionalProperties": false, "properties": { + "Architectures": { + "items": { + "type": "string" + }, + "type": "array" + }, "AssumeRolePolicyDocument": { "type": "object" }, @@ -125862,6 +125868,12 @@ }, "Function": { "properties": { + "Architectures": { + "items": { + "type": "string" + }, + "type": "array" + }, "AssumeRolePolicyDocument": { "type": "object" },