diff --git a/CHANGELOG.md b/CHANGELOG.md index 4d91b2901d..53769eb6f7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ ## HEAD (Unreleased) +- Add lambda.Function support for pulumi Assets [#182](https://github.com/pulumi/pulumi-aws-native/pull/182) + ## 0.2.0 (October 8, 2021) - Deduplicate type names [#160](https://github.com/pulumi/pulumi-aws-native/issues/160) diff --git a/aws-cloudformation-user-guide b/aws-cloudformation-user-guide index 3fb5aebc4c..e449d5a771 160000 --- a/aws-cloudformation-user-guide +++ b/aws-cloudformation-user-guide @@ -1 +1 @@ -Subproject commit 3fb5aebc4c5995ce50c0f035b77c7ca545a554ff +Subproject commit e449d5a771f700a0e633293b7698919f47082fe0 diff --git a/examples/aws-native-ts-stepfunctions/index.ts b/examples/aws-native-ts-stepfunctions/index.ts index 3358c97856..4a2ab2d2d3 100644 --- a/examples/aws-native-ts-stepfunctions/index.ts +++ b/examples/aws-native-ts-stepfunctions/index.ts @@ -45,11 +45,7 @@ const worldFunction = new awsnative.lambda.Function('worldFunction', runtime: "nodejs14.x", handler: "index.handler", code: { - zipFile: `exports.handler = function(event, context, callback){ - var response = event.response; - const updated = { "response": response + "World!" }; - callback(null, updated); - };`, + zipFile: new pulumi.asset.FileAsset("world_function.js"), }, }, {dependsOn: lambdaRolePolicy}); diff --git a/examples/aws-native-ts-stepfunctions/world_function.js b/examples/aws-native-ts-stepfunctions/world_function.js new file mode 100644 index 0000000000..6040d76c39 --- /dev/null +++ b/examples/aws-native-ts-stepfunctions/world_function.js @@ -0,0 +1,5 @@ +exports.handler = function(event, context, callback){ + var response = event.response; + const updated = { "response": response + "World!" }; + callback(null, updated); +}; diff --git a/examples/simple-ts/index.ts b/examples/simple-ts/index.ts index 227e1e6efb..8793110fc3 100644 --- a/examples/simple-ts/index.ts +++ b/examples/simple-ts/index.ts @@ -1,4 +1,18 @@ -// Copyright 2016-2021, Pulumi Corporation. +/* + * Copyright 2016-2021, Pulumi Corporation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ import * as aws from "@pulumi/aws-native"; import * as random from "@pulumi/random"; diff --git a/provider/cmd/cf2pulumi/schema-full.json b/provider/cmd/cf2pulumi/schema-full.json index f783f53f13..3b00060faf 100644 --- a/provider/cmd/cf2pulumi/schema-full.json +++ b/provider/cmd/cf2pulumi/schema-full.json @@ -44953,7 +44953,7 @@ "description": "For versioned objects, the version of the deployment package object to use." }, "zipFile": { - "type": "string", + "$ref": "pulumi.json#/Asset", "description": "The source code of your Lambda function. If you include your function source inline with this parameter, AWS CloudFormation places it in a file named index and zips it to create a deployment package.." } }, diff --git a/provider/cmd/pulumi-resource-aws-native/metadata.json b/provider/cmd/pulumi-resource-aws-native/metadata.json index c4e7cc2673..9544f2b584 100644 --- a/provider/cmd/pulumi-resource-aws-native/metadata.json +++ b/provider/cmd/pulumi-resource-aws-native/metadata.json @@ -45159,7 +45159,7 @@ "description": "For versioned objects, the version of the deployment package object to use." }, "zipFile": { - "type": "string", + "$ref": "pulumi.json#/Asset", "description": "The source code of your Lambda function. If you include your function source inline with this parameter, AWS CloudFormation places it in a file named index and zips it to create a deployment package.." } } diff --git a/provider/cmd/pulumi-resource-aws-native/schema.json b/provider/cmd/pulumi-resource-aws-native/schema.json index f3f3324838..fd37f628b7 100644 --- a/provider/cmd/pulumi-resource-aws-native/schema.json +++ b/provider/cmd/pulumi-resource-aws-native/schema.json @@ -28986,7 +28986,7 @@ "description": "For versioned objects, the version of the deployment package object to use." }, "zipFile": { - "type": "string", + "$ref": "pulumi.json#/Asset", "description": "The source code of your Lambda function. If you include your function source inline with this parameter, AWS CloudFormation places it in a file named index and zips it to create a deployment package.." } }, @@ -64183,7 +64183,7 @@ ] }, "aws-native:lambda:Function": { - "description": "Resource Type definition for AWS::Lambda::Function\n\n{{% examples %}}\n## Example Usage\n{{% example %}}\n### Example\n```csharp\nusing Pulumi;\nusing AwsNative = Pulumi.AwsNative;\n\nclass MyStack : Stack\n{\n public MyStack()\n {\n var primer = new AwsNative.Lambda.Function(\"primer\", new AwsNative.Lambda.FunctionArgs\n {\n Runtime = \"nodejs12.x\",\n Role = \"arn:aws:iam::123456789012:role/lambda-role\",\n Handler = \"index.handler\",\n Code = new AwsNative.Lambda.Inputs.FunctionCodeArgs\n {\n ZipFile = @\"var aws = require('aws-sdk')\nvar response = require('cfn-response')\nexports.handler = function(event, context) {\n console.log(\"\"REQUEST RECEIVED:\\n\"\" + JSON.stringify(event))\n // For Delete requests, immediately send a SUCCESS response.\n if (event.RequestType == \"\"Delete\"\") {\n response.send(event, context, \"\"SUCCESS\"\")\n return\n }\n var responseStatus = \"\"FAILED\"\"\n var responseData = {}\n var functionName = event.ResourceProperties.FunctionName\n var lambda = new aws.Lambda()\n lambda.invoke({ FunctionName: functionName }, function(err, invokeResult) {\n if (err) {\n responseData = {Error: \"\"Invoke call failed\"\"}\n console.log(responseData.Error + \"\":\\n\"\", err)\n }\n else responseStatus = \"\"SUCCESS\"\"\n response.send(event, context, responseStatus, responseData)\n })\n}\n\",\n },\n Description = \"Invoke a function during stack creation.\",\n TracingConfig = new AwsNative.Lambda.Inputs.FunctionTracingConfigArgs\n {\n Mode = \"Active\",\n },\n });\n }\n\n}\n\n```\n\n```go\npackage main\n\nimport (\n\t\"github.com/pulumi/pulumi-aws-native/sdk/go/aws/lambda\"\n\t\"github.com/pulumi/pulumi/sdk/v3/go/pulumi\"\n)\n\nfunc main() {\n\tpulumi.Run(func(ctx *pulumi.Context) error {\n\t\t_, err := lambda.NewFunction(ctx, \"primer\", \u0026lambda.FunctionArgs{\n\t\t\tRuntime: pulumi.String(\"nodejs12.x\"),\n\t\t\tRole: pulumi.String(\"arn:aws:iam::123456789012:role/lambda-role\"),\n\t\t\tHandler: pulumi.String(\"index.handler\"),\n\t\t\tCode: \u0026lambda.FunctionCodeArgs{\n\t\t\t\tZipFile: pulumi.String(\"var aws = require('aws-sdk')\\nvar response = require('cfn-response')\\nexports.handler = function(event, context) {\\n console.log(\\\"REQUEST RECEIVED:\\\\n\\\" + JSON.stringify(event))\\n // For Delete requests, immediately send a SUCCESS response.\\n if (event.RequestType == \\\"Delete\\\") {\\n response.send(event, context, \\\"SUCCESS\\\")\\n return\\n }\\n var responseStatus = \\\"FAILED\\\"\\n var responseData = {}\\n var functionName = event.ResourceProperties.FunctionName\\n var lambda = new aws.Lambda()\\n lambda.invoke({ FunctionName: functionName }, function(err, invokeResult) {\\n if (err) {\\n responseData = {Error: \\\"Invoke call failed\\\"}\\n console.log(responseData.Error + \\\":\\\\n\\\", err)\\n }\\n else responseStatus = \\\"SUCCESS\\\"\\n response.send(event, context, responseStatus, responseData)\\n })\\n}\\n\"),\n\t\t\t},\n\t\t\tDescription: pulumi.String(\"Invoke a function during stack creation.\"),\n\t\t\tTracingConfig: \u0026lambda.FunctionTracingConfigArgs{\n\t\t\t\tMode: \"Active\",\n\t\t\t},\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn nil\n\t})\n}\n\n```\n\n```typescript\nimport * as pulumi from \"@pulumi/pulumi\";\nimport * as aws_native from \"@pulumi/aws-native\";\n\nconst primer = new aws_native.lambda.Function(\"primer\", {\n runtime: \"nodejs12.x\",\n role: \"arn:aws:iam::123456789012:role/lambda-role\",\n handler: \"index.handler\",\n code: {\n zipFile: `var aws = require('aws-sdk')\nvar response = require('cfn-response')\nexports.handler = function(event, context) {\n console.log(\"REQUEST RECEIVED:\\\\n\" + JSON.stringify(event))\n // For Delete requests, immediately send a SUCCESS response.\n if (event.RequestType == \"Delete\") {\n response.send(event, context, \"SUCCESS\")\n return\n }\n var responseStatus = \"FAILED\"\n var responseData = {}\n var functionName = event.ResourceProperties.FunctionName\n var lambda = new aws.Lambda()\n lambda.invoke({ FunctionName: functionName }, function(err, invokeResult) {\n if (err) {\n responseData = {Error: \"Invoke call failed\"}\n console.log(responseData.Error + \":\\\\n\", err)\n }\n else responseStatus = \"SUCCESS\"\n response.send(event, context, responseStatus, responseData)\n })\n}\n`,\n },\n description: \"Invoke a function during stack creation.\",\n tracingConfig: {\n mode: \"Active\",\n },\n});\n\n```\n\n```python\nimport pulumi\nimport pulumi_aws_native as aws_native\n\nprimer = aws_native.lambda_.Function(\"primer\",\n runtime=\"nodejs12.x\",\n role=\"arn:aws:iam::123456789012:role/lambda-role\",\n handler=\"index.handler\",\n code=aws_native.lambda..FunctionCodeArgs(\n zip_file=\"\"\"var aws = require('aws-sdk')\nvar response = require('cfn-response')\nexports.handler = function(event, context) {\n console.log(\"REQUEST RECEIVED:\\n\" + JSON.stringify(event))\n // For Delete requests, immediately send a SUCCESS response.\n if (event.RequestType == \"Delete\") {\n response.send(event, context, \"SUCCESS\")\n return\n }\n var responseStatus = \"FAILED\"\n var responseData = {}\n var functionName = event.ResourceProperties.FunctionName\n var lambda = new aws.Lambda()\n lambda.invoke({ FunctionName: functionName }, function(err, invokeResult) {\n if (err) {\n responseData = {Error: \"Invoke call failed\"}\n console.log(responseData.Error + \":\\n\", err)\n }\n else responseStatus = \"SUCCESS\"\n response.send(event, context, responseStatus, responseData)\n })\n}\n\"\"\",\n ),\n description=\"Invoke a function during stack creation.\",\n tracing_config=aws_native.lambda..FunctionTracingConfigArgs(\n mode=\"Active\",\n ))\n\n```\n\n{{% /example %}}\n{{% example %}}\n### Example\n```csharp\nusing Pulumi;\nusing AwsNative = Pulumi.AwsNative;\n\nclass MyStack : Stack\n{\n public MyStack()\n {\n var function = new AwsNative.Lambda.Function(\"function\", new AwsNative.Lambda.FunctionArgs\n {\n Handler = \"index.handler\",\n Role = \"arn:aws:iam::123456789012:role/lambda-role\",\n Code = new AwsNative.Lambda.Inputs.FunctionCodeArgs\n {\n S3Bucket = \"my-bucket\",\n S3Key = \"function.zip\",\n },\n Runtime = \"nodejs12.x\",\n Timeout = 5,\n TracingConfig = new AwsNative.Lambda.Inputs.FunctionTracingConfigArgs\n {\n Mode = \"Active\",\n },\n VpcConfig = new AwsNative.Lambda.Inputs.FunctionVpcConfigArgs\n {\n SecurityGroupIds = \n {\n \"sg-085912345678492fb\",\n },\n SubnetIds = \n {\n \"subnet-071f712345678e7c8\",\n \"subnet-07fd123456788a036\",\n },\n },\n });\n }\n\n}\n\n```\n\n```go\npackage main\n\nimport (\n\t\"github.com/pulumi/pulumi-aws-native/sdk/go/aws/lambda\"\n\t\"github.com/pulumi/pulumi/sdk/v3/go/pulumi\"\n)\n\nfunc main() {\n\tpulumi.Run(func(ctx *pulumi.Context) error {\n\t\t_, err := lambda.NewFunction(ctx, \"function\", \u0026lambda.FunctionArgs{\n\t\t\tHandler: pulumi.String(\"index.handler\"),\n\t\t\tRole: pulumi.String(\"arn:aws:iam::123456789012:role/lambda-role\"),\n\t\t\tCode: \u0026lambda.FunctionCodeArgs{\n\t\t\t\tS3Bucket: pulumi.String(\"my-bucket\"),\n\t\t\t\tS3Key: pulumi.String(\"function.zip\"),\n\t\t\t},\n\t\t\tRuntime: pulumi.String(\"nodejs12.x\"),\n\t\t\tTimeout: pulumi.Int(5),\n\t\t\tTracingConfig: \u0026lambda.FunctionTracingConfigArgs{\n\t\t\t\tMode: \"Active\",\n\t\t\t},\n\t\t\tVpcConfig: \u0026lambda.FunctionVpcConfigArgs{\n\t\t\t\tSecurityGroupIds: pulumi.StringArray{\n\t\t\t\t\tpulumi.String(\"sg-085912345678492fb\"),\n\t\t\t\t},\n\t\t\t\tSubnetIds: pulumi.StringArray{\n\t\t\t\t\tpulumi.String(\"subnet-071f712345678e7c8\"),\n\t\t\t\t\tpulumi.String(\"subnet-07fd123456788a036\"),\n\t\t\t\t},\n\t\t\t},\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn nil\n\t})\n}\n\n```\n\n```typescript\nimport * as pulumi from \"@pulumi/pulumi\";\nimport * as aws_native from \"@pulumi/aws-native\";\n\nconst _function = new aws_native.lambda.Function(\"function\", {\n handler: \"index.handler\",\n role: \"arn:aws:iam::123456789012:role/lambda-role\",\n code: {\n s3Bucket: \"my-bucket\",\n s3Key: \"function.zip\",\n },\n runtime: \"nodejs12.x\",\n timeout: 5,\n tracingConfig: {\n mode: \"Active\",\n },\n vpcConfig: {\n securityGroupIds: [\"sg-085912345678492fb\"],\n subnetIds: [\n \"subnet-071f712345678e7c8\",\n \"subnet-07fd123456788a036\",\n ],\n },\n});\n\n```\n\n```python\nimport pulumi\nimport pulumi_aws_native as aws_native\n\nfunction = aws_native.lambda_.Function(\"function\",\n handler=\"index.handler\",\n role=\"arn:aws:iam::123456789012:role/lambda-role\",\n code=aws_native.lambda..FunctionCodeArgs(\n s3_bucket=\"my-bucket\",\n s3_key=\"function.zip\",\n ),\n runtime=\"nodejs12.x\",\n timeout=5,\n tracing_config=aws_native.lambda..FunctionTracingConfigArgs(\n mode=\"Active\",\n ),\n vpc_config=aws_native.lambda..FunctionVpcConfigArgs(\n security_group_ids=[\"sg-085912345678492fb\"],\n subnet_ids=[\n \"subnet-071f712345678e7c8\",\n \"subnet-07fd123456788a036\",\n ],\n ))\n\n```\n\n{{% /example %}}\n{{% /examples %}}\n", + "description": "Resource Type definition for AWS::Lambda::Function\n\n{{% examples %}}\n## Example Usage\n{{% example %}}\n### Example\n```csharp\nusing Pulumi;\nusing AwsNative = Pulumi.AwsNative;\n\nclass MyStack : Stack\n{\n public MyStack()\n {\n var primer = new AwsNative.Lambda.Function(\"primer\", new AwsNative.Lambda.FunctionArgs\n {\n Runtime = \"nodejs12.x\",\n Role = \"arn:aws:iam::123456789012:role/lambda-role\",\n Handler = \"index.handler\",\n Code = new AwsNative.Lambda.Inputs.FunctionCodeArgs\n {\n ZipFile = @\"var aws = require('aws-sdk')\nvar response = require('cfn-response')\nexports.handler = function(event, context) {\n console.log(\"\"REQUEST RECEIVED:\\n\"\" + JSON.stringify(event))\n // For Delete requests, immediately send a SUCCESS response.\n if (event.RequestType == \"\"Delete\"\") {\n response.send(event, context, \"\"SUCCESS\"\")\n return\n }\n var responseStatus = \"\"FAILED\"\"\n var responseData = {}\n var functionName = event.ResourceProperties.FunctionName\n var lambda = new aws.Lambda()\n lambda.invoke({ FunctionName: functionName }, function(err, invokeResult) {\n if (err) {\n responseData = {Error: \"\"Invoke call failed\"\"}\n console.log(responseData.Error + \"\":\\n\"\", err)\n }\n else responseStatus = \"\"SUCCESS\"\"\n response.send(event, context, responseStatus, responseData)\n })\n}\n\",\n },\n Description = \"Invoke a function during stack creation.\",\n TracingConfig = new AwsNative.Lambda.Inputs.FunctionTracingConfigArgs\n {\n Mode = \"Active\",\n },\n });\n }\n\n}\n\n```\n\n```go\npackage main\n\nimport (\n\t\"github.com/pulumi/pulumi-aws-native/sdk/go/aws/lambda\"\n\t\"github.com/pulumi/pulumi/sdk/v3/go/pulumi\"\n)\n\nfunc main() {\n\tpulumi.Run(func(ctx *pulumi.Context) error {\n\t\t_, err := lambda.NewFunction(ctx, \"primer\", \u0026lambda.FunctionArgs{\n\t\t\tRuntime: pulumi.String(\"nodejs12.x\"),\n\t\t\tRole: pulumi.String(\"arn:aws:iam::123456789012:role/lambda-role\"),\n\t\t\tHandler: pulumi.String(\"index.handler\"),\n\t\t\tCode: \u0026lambda.FunctionCodeArgs{\n\t\t\t\tZipFile: pulumi.AssetOrArchive(\"var aws = require('aws-sdk')\\nvar response = require('cfn-response')\\nexports.handler = function(event, context) {\\n console.log(\\\"REQUEST RECEIVED:\\\\n\\\" + JSON.stringify(event))\\n // For Delete requests, immediately send a SUCCESS response.\\n if (event.RequestType == \\\"Delete\\\") {\\n response.send(event, context, \\\"SUCCESS\\\")\\n return\\n }\\n var responseStatus = \\\"FAILED\\\"\\n var responseData = {}\\n var functionName = event.ResourceProperties.FunctionName\\n var lambda = new aws.Lambda()\\n lambda.invoke({ FunctionName: functionName }, function(err, invokeResult) {\\n if (err) {\\n responseData = {Error: \\\"Invoke call failed\\\"}\\n console.log(responseData.Error + \\\":\\\\n\\\", err)\\n }\\n else responseStatus = \\\"SUCCESS\\\"\\n response.send(event, context, responseStatus, responseData)\\n })\\n}\\n\"),\n\t\t\t},\n\t\t\tDescription: pulumi.String(\"Invoke a function during stack creation.\"),\n\t\t\tTracingConfig: \u0026lambda.FunctionTracingConfigArgs{\n\t\t\t\tMode: \"Active\",\n\t\t\t},\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn nil\n\t})\n}\n\n```\n\n```typescript\nimport * as pulumi from \"@pulumi/pulumi\";\nimport * as aws_native from \"@pulumi/aws-native\";\n\nconst primer = new aws_native.lambda.Function(\"primer\", {\n runtime: \"nodejs12.x\",\n role: \"arn:aws:iam::123456789012:role/lambda-role\",\n handler: \"index.handler\",\n code: {\n zipFile: `var aws = require('aws-sdk')\nvar response = require('cfn-response')\nexports.handler = function(event, context) {\n console.log(\"REQUEST RECEIVED:\\\\n\" + JSON.stringify(event))\n // For Delete requests, immediately send a SUCCESS response.\n if (event.RequestType == \"Delete\") {\n response.send(event, context, \"SUCCESS\")\n return\n }\n var responseStatus = \"FAILED\"\n var responseData = {}\n var functionName = event.ResourceProperties.FunctionName\n var lambda = new aws.Lambda()\n lambda.invoke({ FunctionName: functionName }, function(err, invokeResult) {\n if (err) {\n responseData = {Error: \"Invoke call failed\"}\n console.log(responseData.Error + \":\\\\n\", err)\n }\n else responseStatus = \"SUCCESS\"\n response.send(event, context, responseStatus, responseData)\n })\n}\n`,\n },\n description: \"Invoke a function during stack creation.\",\n tracingConfig: {\n mode: \"Active\",\n },\n});\n\n```\n\n```python\nimport pulumi\nimport pulumi_aws_native as aws_native\n\nprimer = aws_native.lambda_.Function(\"primer\",\n runtime=\"nodejs12.x\",\n role=\"arn:aws:iam::123456789012:role/lambda-role\",\n handler=\"index.handler\",\n code=aws_native.lambda..FunctionCodeArgs(\n zip_file=\"\"\"var aws = require('aws-sdk')\nvar response = require('cfn-response')\nexports.handler = function(event, context) {\n console.log(\"REQUEST RECEIVED:\\n\" + JSON.stringify(event))\n // For Delete requests, immediately send a SUCCESS response.\n if (event.RequestType == \"Delete\") {\n response.send(event, context, \"SUCCESS\")\n return\n }\n var responseStatus = \"FAILED\"\n var responseData = {}\n var functionName = event.ResourceProperties.FunctionName\n var lambda = new aws.Lambda()\n lambda.invoke({ FunctionName: functionName }, function(err, invokeResult) {\n if (err) {\n responseData = {Error: \"Invoke call failed\"}\n console.log(responseData.Error + \":\\n\", err)\n }\n else responseStatus = \"SUCCESS\"\n response.send(event, context, responseStatus, responseData)\n })\n}\n\"\"\",\n ),\n description=\"Invoke a function during stack creation.\",\n tracing_config=aws_native.lambda..FunctionTracingConfigArgs(\n mode=\"Active\",\n ))\n\n```\n\n{{% /example %}}\n{{% example %}}\n### Example\n```csharp\nusing Pulumi;\nusing AwsNative = Pulumi.AwsNative;\n\nclass MyStack : Stack\n{\n public MyStack()\n {\n var function = new AwsNative.Lambda.Function(\"function\", new AwsNative.Lambda.FunctionArgs\n {\n Handler = \"index.handler\",\n Role = \"arn:aws:iam::123456789012:role/lambda-role\",\n Code = new AwsNative.Lambda.Inputs.FunctionCodeArgs\n {\n S3Bucket = \"my-bucket\",\n S3Key = \"function.zip\",\n },\n Runtime = \"nodejs12.x\",\n Timeout = 5,\n TracingConfig = new AwsNative.Lambda.Inputs.FunctionTracingConfigArgs\n {\n Mode = \"Active\",\n },\n VpcConfig = new AwsNative.Lambda.Inputs.FunctionVpcConfigArgs\n {\n SecurityGroupIds = \n {\n \"sg-085912345678492fb\",\n },\n SubnetIds = \n {\n \"subnet-071f712345678e7c8\",\n \"subnet-07fd123456788a036\",\n },\n },\n });\n }\n\n}\n\n```\n\n```go\npackage main\n\nimport (\n\t\"github.com/pulumi/pulumi-aws-native/sdk/go/aws/lambda\"\n\t\"github.com/pulumi/pulumi/sdk/v3/go/pulumi\"\n)\n\nfunc main() {\n\tpulumi.Run(func(ctx *pulumi.Context) error {\n\t\t_, err := lambda.NewFunction(ctx, \"function\", \u0026lambda.FunctionArgs{\n\t\t\tHandler: pulumi.String(\"index.handler\"),\n\t\t\tRole: pulumi.String(\"arn:aws:iam::123456789012:role/lambda-role\"),\n\t\t\tCode: \u0026lambda.FunctionCodeArgs{\n\t\t\t\tS3Bucket: pulumi.String(\"my-bucket\"),\n\t\t\t\tS3Key: pulumi.String(\"function.zip\"),\n\t\t\t},\n\t\t\tRuntime: pulumi.String(\"nodejs12.x\"),\n\t\t\tTimeout: pulumi.Int(5),\n\t\t\tTracingConfig: \u0026lambda.FunctionTracingConfigArgs{\n\t\t\t\tMode: \"Active\",\n\t\t\t},\n\t\t\tVpcConfig: \u0026lambda.FunctionVpcConfigArgs{\n\t\t\t\tSecurityGroupIds: pulumi.StringArray{\n\t\t\t\t\tpulumi.String(\"sg-085912345678492fb\"),\n\t\t\t\t},\n\t\t\t\tSubnetIds: pulumi.StringArray{\n\t\t\t\t\tpulumi.String(\"subnet-071f712345678e7c8\"),\n\t\t\t\t\tpulumi.String(\"subnet-07fd123456788a036\"),\n\t\t\t\t},\n\t\t\t},\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn nil\n\t})\n}\n\n```\n\n```typescript\nimport * as pulumi from \"@pulumi/pulumi\";\nimport * as aws_native from \"@pulumi/aws-native\";\n\nconst _function = new aws_native.lambda.Function(\"function\", {\n handler: \"index.handler\",\n role: \"arn:aws:iam::123456789012:role/lambda-role\",\n code: {\n s3Bucket: \"my-bucket\",\n s3Key: \"function.zip\",\n },\n runtime: \"nodejs12.x\",\n timeout: 5,\n tracingConfig: {\n mode: \"Active\",\n },\n vpcConfig: {\n securityGroupIds: [\"sg-085912345678492fb\"],\n subnetIds: [\n \"subnet-071f712345678e7c8\",\n \"subnet-07fd123456788a036\",\n ],\n },\n});\n\n```\n\n```python\nimport pulumi\nimport pulumi_aws_native as aws_native\n\nfunction = aws_native.lambda_.Function(\"function\",\n handler=\"index.handler\",\n role=\"arn:aws:iam::123456789012:role/lambda-role\",\n code=aws_native.lambda..FunctionCodeArgs(\n s3_bucket=\"my-bucket\",\n s3_key=\"function.zip\",\n ),\n runtime=\"nodejs12.x\",\n timeout=5,\n tracing_config=aws_native.lambda..FunctionTracingConfigArgs(\n mode=\"Active\",\n ),\n vpc_config=aws_native.lambda..FunctionVpcConfigArgs(\n security_group_ids=[\"sg-085912345678492fb\"],\n subnet_ids=[\n \"subnet-071f712345678e7c8\",\n \"subnet-07fd123456788a036\",\n ],\n ))\n\n```\n\n{{% /example %}}\n{{% /examples %}}\n", "properties": { "architectures": { "type": "array", diff --git a/provider/go.sum b/provider/go.sum index c63e5e005f..93a04c89a8 100644 --- a/provider/go.sum +++ b/provider/go.sum @@ -485,8 +485,9 @@ github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxv github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= -github.com/kr/pretty v0.2.1 h1:Fmg33tUaq4/8ym9TJN1x7sLJnHVwhP33CNkpYV/7rwI= github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= +github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0= +github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/pty v1.1.4/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/pty v1.1.8 h1:AkaSdXYQOWeaO3neb8EM634ahkXXe3jYbVh/F9lq+GI= diff --git a/provider/pkg/provider/provider.go b/provider/pkg/provider/provider.go index 15d9d021a1..03908f7eb9 100644 --- a/provider/pkg/provider/provider.go +++ b/provider/pkg/provider/provider.go @@ -235,7 +235,7 @@ func (p *cfnProvider) DiffConfig(ctx context.Context, req *pulumirpc.DiffRequest news, err := plugin.UnmarshalProperties(req.GetNews(), plugin.MarshalOptions{ Label: fmt.Sprintf("%s.news", label), KeepUnknowns: true, - RejectAssets: true, + RejectAssets: false, }) if err != nil { return nil, errors.Wrapf(err, "diffConfig failed because of malformed resource inputs") @@ -511,7 +511,7 @@ func (p *cfnProvider) Check(ctx context.Context, req *pulumirpc.CheckRequest) (* newInputs, err := plugin.UnmarshalProperties(req.GetNews(), plugin.MarshalOptions{ Label: fmt.Sprintf("%s.properties", label), KeepUnknowns: true, - RejectAssets: true, + RejectAssets: false, KeepSecrets: true, }) if err != nil { @@ -579,7 +579,7 @@ func (p *cfnProvider) Create(ctx context.Context, req *pulumirpc.CreateRequest) inputs, err := plugin.UnmarshalProperties(req.GetProperties(), plugin.MarshalOptions{ Label: fmt.Sprintf("%s.properties", label), KeepUnknowns: true, - RejectAssets: true, + RejectAssets: false, KeepSecrets: true, }) if err != nil { @@ -611,7 +611,10 @@ func (p *cfnProvider) Create(ctx context.Context, req *pulumirpc.CreateRequest) cfType = spec.CfType // Convert SDK inputs to CFN payload. - payload = schema.SdkToCfn(&spec, p.resourceMap.Types, inputs.MapRepl(nil, mapReplStripSecrets)) + payload, err = schema.SdkToCfn(&spec, p.resourceMap.Types, inputs.MapRepl(nil, mapReplStripSecrets)) + if err != nil { + return nil, fmt.Errorf("failed to convert SDK inputs to CFN: %w", err) + } } // Serialize inputs as a desired state JSON. @@ -814,7 +817,7 @@ func (p *cfnProvider) Update(ctx context.Context, req *pulumirpc.UpdateRequest) newInputs, err := plugin.UnmarshalProperties(req.GetNews(), plugin.MarshalOptions{ Label: fmt.Sprintf("%s.newInputs", label), KeepUnknowns: true, - RejectAssets: true, + RejectAssets: false, KeepSecrets: true, }) if err != nil { @@ -1001,7 +1004,7 @@ func (p *cfnProvider) diffState(olds *pbstruct.Struct, news *pbstruct.Struct, la oldState, err := plugin.UnmarshalProperties(olds, plugin.MarshalOptions{ Label: fmt.Sprintf("%s.oldState", label), KeepUnknowns: true, - RejectAssets: true, + RejectAssets: false, KeepSecrets: true, }) if err != nil { @@ -1014,7 +1017,7 @@ func (p *cfnProvider) diffState(olds *pbstruct.Struct, news *pbstruct.Struct, la newInputs, err := plugin.UnmarshalProperties(news, plugin.MarshalOptions{ Label: fmt.Sprintf("%s.newInputs", label), KeepUnknowns: true, - RejectAssets: true, + RejectAssets: false, KeepSecrets: true, }) if err != nil { diff --git a/provider/pkg/schema/convert.go b/provider/pkg/schema/convert.go index 4ec7bba8d1..5f6a91ee13 100644 --- a/provider/pkg/schema/convert.go +++ b/provider/pkg/schema/convert.go @@ -1,4 +1,16 @@ // Copyright 2016-2021, Pulumi Corporation. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. package schema @@ -15,7 +27,7 @@ import ( // SdkToCfn converts Pulumi-SDK-shaped state to CloudFormation-shaped payload. In particular, SDK properties // are lowerCamelCase, while CloudFormation is usually (but not always) PascalCase. -func SdkToCfn(res *CloudAPIResource, types map[string]CloudAPIType, properties map[string]interface{}) map[string]interface{} { +func SdkToCfn(res *CloudAPIResource, types map[string]CloudAPIType, properties map[string]interface{}) (map[string]interface{}, error) { converter := sdkToCfnConverter{res, types} return converter.sdkToCfn(properties) } @@ -24,7 +36,7 @@ func SdkToCfn(res *CloudAPIResource, types map[string]CloudAPIType, properties m // mapped to corresponding patch terms, and SDK properties are translated to respective CFN names. func DiffToPatch(res *CloudAPIResource, types map[string]CloudAPIType, diff *resource.ObjectDiff) ([]jsonpatch.JsonPatchOperation, error) { converter := sdkToCfnConverter{res, types} - return converter.diffToPatch(diff), nil + return converter.diffToPatch(diff) } type sdkToCfnConverter struct { @@ -32,90 +44,124 @@ type sdkToCfnConverter struct { types map[string]CloudAPIType } -func (c *sdkToCfnConverter) sdkToCfn(properties map[string]interface{}) map[string]interface{} { +func (c *sdkToCfnConverter) sdkToCfn(properties map[string]interface{}) (map[string]interface{}, error) { result := map[string]interface{}{} + var err error for k, prop := range c.spec.Inputs { if v, ok := properties[k]; ok { - result[ToCfnName(k)] = c.sdkTypedValueToCfn(&prop.TypeSpec, v) + result[ToCfnName(k)], err = c.sdkTypedValueToCfn(&prop.TypeSpec, v) + if err != nil { + return nil, err + } } } for k, attr := range c.spec.Outputs { if v, ok := properties[k]; ok { - result[ToCfnName(k)] = c.sdkTypedValueToCfn(&attr.TypeSpec, v) + result[ToCfnName(k)], err = c.sdkTypedValueToCfn(&attr.TypeSpec, v) + if err != nil { + return nil, err + } } } - return result + return result, nil } -func (c *sdkToCfnConverter) sdkTypedValueToCfn(spec *pschema.TypeSpec, v interface{}) interface{} { +func (c *sdkToCfnConverter) sdkTypedValueToCfn(spec *pschema.TypeSpec, v interface{}) (interface{}, error) { if spec.Ref != "" { - if spec.Ref == "pulumi.json#/Any" { - return v + switch spec.Ref { + case "pulumi.json#/Any": + return v, nil + case "pulumi.json#/Asset", "pulumi.json#/Archive": + switch t := v.(type) { + case *resource.Asset: + b, err := t.Bytes() + if err != nil { + return nil, err + } + return string(b), nil + } } typName := strings.TrimPrefix(spec.Ref, "#/types/") return c.sdkObjectValueToCfn(typName, v) } + var err error switch spec.Type { case "array": array := v.([]interface{}) vs := make([]interface{}, len(array)) for i, item := range array { - vs[i] = c.sdkTypedValueToCfn(spec.Items, item) + vs[i], err = c.sdkTypedValueToCfn(spec.Items, item) + if err != nil { + return nil, err + } } - return vs + return vs, nil case "object": sourceMap := v.(map[string]interface{}) vs := map[string]interface{}{} for n, item := range sourceMap { - vs[n] = c.sdkTypedValueToCfn(spec.AdditionalProperties, item) + vs[n], err = c.sdkTypedValueToCfn(spec.AdditionalProperties, item) + if err != nil { + return nil, err + } } - return vs + return vs, nil default: - return v + return v, nil } } -func (c *sdkToCfnConverter) sdkObjectValueToCfn(typeName string, value interface{}) interface{} { +func (c *sdkToCfnConverter) sdkObjectValueToCfn(typeName string, value interface{}) (interface{}, error) { properties, ok := value.(map[string]interface{}) if !ok { - return value + return value, nil } spec := c.types[typeName] result := map[string]interface{}{} + var err error for k, prop := range spec.Properties { if v, ok := properties[k]; ok { - result[ToCfnName(k)] = c.sdkTypedValueToCfn(&prop.TypeSpec, v) + result[ToCfnName(k)], err = c.sdkTypedValueToCfn(&prop.TypeSpec, v) + if err != nil { + return nil, err + } } } - return result + return result, nil } -func (c *sdkToCfnConverter) diffToPatch(diff *resource.ObjectDiff) []jsonpatch.JsonPatchOperation { +func (c *sdkToCfnConverter) diffToPatch(diff *resource.ObjectDiff) ([]jsonpatch.JsonPatchOperation, error) { var ops []jsonpatch.JsonPatchOperation for sdkName, prop := range c.spec.Inputs { cfnName := ToCfnName(sdkName) key := resource.PropertyKey(sdkName) if v, ok := diff.Updates[key]; ok { - op := c.valueToPatch("replace", cfnName, prop, v.New) + op, err := c.valueToPatch("replace", cfnName, prop, v.New) + if err != nil { + return nil, err + } ops = append(ops, op) } if v, ok := diff.Adds[key]; ok { - op := c.valueToPatch("add", cfnName, prop, v) + op, err := c.valueToPatch("add", cfnName, prop, v) + if err != nil { + return nil, err + } ops = append(ops, op) } if _, ok := diff.Deletes[key]; ok { - op := jsonpatch.NewPatch("remove", "/" + cfnName, nil) + op := jsonpatch.NewPatch("remove", "/"+cfnName, nil) ops = append(ops, op) } } - return ops + return ops, nil } -func (c *sdkToCfnConverter) valueToPatch(opName, propName string, prop pschema.PropertySpec, value resource.PropertyValue) jsonpatch.JsonPatchOperation { - op := jsonpatch.NewPatch(opName, "/" + propName, nil) +func (c *sdkToCfnConverter) valueToPatch(opName, propName string, prop pschema.PropertySpec, value resource.PropertyValue) (jsonpatch.JsonPatchOperation, error) { + op := jsonpatch.NewPatch(opName, "/"+propName, nil) switch { case value.IsNumber() && prop.Type == "integer": i := int32(value.NumberValue()) @@ -128,12 +174,15 @@ func (c *sdkToCfnConverter) valueToPatch(opName, propName string, prop pschema.P op.Value = value.StringValue() default: sdkObj := value.MapRepl(nil, nil) - cfnObj := c.sdkTypedValueToCfn(&prop.TypeSpec, sdkObj) + cfnObj, err := c.sdkTypedValueToCfn(&prop.TypeSpec, sdkObj) + if err != nil { + return jsonpatch.JsonPatchOperation{}, err + } jsonBytes, err := json.Marshal(cfnObj) contract.AssertNoError(err) op.Value = string(jsonBytes) } - return op + return op, nil } // CfnToSdk converts CloudFormation-shaped payload to Pulumi-SDK-shaped state. In particular, SDK properties diff --git a/provider/pkg/schema/convert_test.go b/provider/pkg/schema/convert_test.go index 074a3bbcb0..02fbd24fe0 100644 --- a/provider/pkg/schema/convert_test.go +++ b/provider/pkg/schema/convert_test.go @@ -1,4 +1,16 @@ // Copyright 2016-2021, Pulumi Corporation. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. package schema @@ -19,7 +31,8 @@ func TestCfnToSdk(t *testing.T) { func TestSdkToCfn(t *testing.T) { res := sampleSchema.Resources["aws-native:ecs:Service"] - actual := SdkToCfn(&res, sampleSchema.Types, sdkState) + actual, err := SdkToCfn(&res, sampleSchema.Types, sdkState) + assert.NoError(t, err) assert.Equal(t, cfnPayload, actual) } diff --git a/provider/pkg/schema/gen.go b/provider/pkg/schema/gen.go index 4adc199ce1..7771ebcddd 100644 --- a/provider/pkg/schema/gen.go +++ b/provider/pkg/schema/gen.go @@ -346,7 +346,7 @@ func GatherPackage(supportedResourceTypes []string, jsonSchemas []jsschema.Schem "region", }, }, - Types: map[string]pschema.ComplexTypeSpec{}, + Types: map[string]pschema.ComplexTypeSpec{}, Resources: map[string]pschema.ResourceSpec{ ExtensionResourceToken: { ObjectTypeSpec: pschema.ObjectTypeSpec{ @@ -427,7 +427,7 @@ func GatherPackage(supportedResourceTypes []string, jsonSchemas []jsschema.Schem CreateOnly: []string{"type", "properties"}, }, }, - Types: map[string]CloudAPIType{}, + Types: map[string]CloudAPIType{}, } supportedResources := codegen.NewStringSet(supportedResourceTypes...) @@ -828,6 +828,9 @@ func (ctx *context) genProperties(parentName string, typeSchema *jsschema.Schema Description: value.Description, TypeSpec: *typeSpec, } + if parentName == "FunctionCode" && name == "ZipFile" { + propertySpec.TypeSpec = pschema.TypeSpec{Ref: "pulumi.json#/Asset"} + } // TODO: temporary workaround to get the 0.1.0 out, let's find a better solution later. if name == "ClusterLogging" { propertySpec.Language = map[string]pschema.RawMessage{ diff --git a/provider/pkg/schema/validate.go b/provider/pkg/schema/validate.go index f292aac4f4..6ab7f22405 100644 --- a/provider/pkg/schema/validate.go +++ b/provider/pkg/schema/validate.go @@ -4,12 +4,13 @@ package schema import ( "fmt" + "math" + "strings" + "github.com/pkg/errors" "github.com/pulumi/pulumi/pkg/v3/codegen" pschema "github.com/pulumi/pulumi/pkg/v3/codegen/schema" "github.com/pulumi/pulumi/sdk/v3/go/common/resource" - "math" - "strings" ) type ValidationFailure struct { @@ -66,7 +67,8 @@ func validateProperty(types map[string]CloudAPIType, required codegen.StringSet, } if spec.Ref != "" { - if spec.Ref == "pulumi.json#/Any" { + switch spec.Ref { + case "pulumi.json#/Any", "pulumi.json#/Asset", "pulumi.json#/Archive": return nil, nil } diff --git a/sdk/dotnet/Lambda/Inputs/FunctionCodeArgs.cs b/sdk/dotnet/Lambda/Inputs/FunctionCodeArgs.cs index 10bed07527..09c08eb31c 100644 --- a/sdk/dotnet/Lambda/Inputs/FunctionCodeArgs.cs +++ b/sdk/dotnet/Lambda/Inputs/FunctionCodeArgs.cs @@ -40,7 +40,7 @@ public sealed class FunctionCodeArgs : Pulumi.ResourceArgs /// The source code of your Lambda function. If you include your function source inline with this parameter, AWS CloudFormation places it in a file named index and zips it to create a deployment package.. /// [Input("zipFile")] - public Input? ZipFile { get; set; } + public Input? ZipFile { get; set; } public FunctionCodeArgs() { diff --git a/sdk/dotnet/Lambda/Outputs/FunctionCode.cs b/sdk/dotnet/Lambda/Outputs/FunctionCode.cs index 7c1afd1cd2..19ac5a647a 100644 --- a/sdk/dotnet/Lambda/Outputs/FunctionCode.cs +++ b/sdk/dotnet/Lambda/Outputs/FunctionCode.cs @@ -32,7 +32,7 @@ public sealed class FunctionCode /// /// The source code of your Lambda function. If you include your function source inline with this parameter, AWS CloudFormation places it in a file named index and zips it to create a deployment package.. /// - public readonly string? ZipFile; + public readonly AssetOrArchive? ZipFile; [OutputConstructor] private FunctionCode( @@ -44,7 +44,7 @@ private FunctionCode( string? s3ObjectVersion, - string? zipFile) + AssetOrArchive? zipFile) { ImageUri = imageUri; S3Bucket = s3Bucket; diff --git a/sdk/go/aws/lambda/pulumiTypes.go b/sdk/go/aws/lambda/pulumiTypes.go index 47916eb8d0..c89801dd05 100644 --- a/sdk/go/aws/lambda/pulumiTypes.go +++ b/sdk/go/aws/lambda/pulumiTypes.go @@ -1753,7 +1753,7 @@ type FunctionCode struct { // For versioned objects, the version of the deployment package object to use. S3ObjectVersion *string `pulumi:"s3ObjectVersion"` // The source code of your Lambda function. If you include your function source inline with this parameter, AWS CloudFormation places it in a file named index and zips it to create a deployment package.. - ZipFile *string `pulumi:"zipFile"` + ZipFile pulumi.AssetOrArchive `pulumi:"zipFile"` } // FunctionCodeInput is an input type that accepts FunctionCodeArgs and FunctionCodeOutput values. @@ -1777,7 +1777,7 @@ type FunctionCodeArgs struct { // For versioned objects, the version of the deployment package object to use. S3ObjectVersion pulumi.StringPtrInput `pulumi:"s3ObjectVersion"` // The source code of your Lambda function. If you include your function source inline with this parameter, AWS CloudFormation places it in a file named index and zips it to create a deployment package.. - ZipFile pulumi.StringPtrInput `pulumi:"zipFile"` + ZipFile pulumi.AssetOrArchiveInput `pulumi:"zipFile"` } func (FunctionCodeArgs) ElementType() reflect.Type { @@ -1878,8 +1878,8 @@ func (o FunctionCodeOutput) S3ObjectVersion() pulumi.StringPtrOutput { } // The source code of your Lambda function. If you include your function source inline with this parameter, AWS CloudFormation places it in a file named index and zips it to create a deployment package.. -func (o FunctionCodeOutput) ZipFile() pulumi.StringPtrOutput { - return o.ApplyT(func(v FunctionCode) *string { return v.ZipFile }).(pulumi.StringPtrOutput) +func (o FunctionCodeOutput) ZipFile() pulumi.AssetOrArchiveOutput { + return o.ApplyT(func(v FunctionCode) pulumi.AssetOrArchive { return v.ZipFile }).(pulumi.AssetOrArchiveOutput) } type FunctionCodePtrOutput struct{ *pulumi.OutputState } @@ -1947,13 +1947,13 @@ func (o FunctionCodePtrOutput) S3ObjectVersion() pulumi.StringPtrOutput { } // The source code of your Lambda function. If you include your function source inline with this parameter, AWS CloudFormation places it in a file named index and zips it to create a deployment package.. -func (o FunctionCodePtrOutput) ZipFile() pulumi.StringPtrOutput { - return o.ApplyT(func(v *FunctionCode) *string { +func (o FunctionCodePtrOutput) ZipFile() pulumi.AssetOrArchiveOutput { + return o.ApplyT(func(v *FunctionCode) pulumi.AssetOrArchive { if v == nil { return nil } return v.ZipFile - }).(pulumi.StringPtrOutput) + }).(pulumi.AssetOrArchiveOutput) } // The dead-letter queue for failed asynchronous invocations. diff --git a/sdk/nodejs/types/input.ts b/sdk/nodejs/types/input.ts index 200c439906..b0910e6b34 100644 --- a/sdk/nodejs/types/input.ts +++ b/sdk/nodejs/types/input.ts @@ -15823,7 +15823,7 @@ export namespace lambda { /** * The source code of your Lambda function. If you include your function source inline with this parameter, AWS CloudFormation places it in a file named index and zips it to create a deployment package.. */ - zipFile?: pulumi.Input; + zipFile?: pulumi.Input; } /** diff --git a/sdk/nodejs/types/output.ts b/sdk/nodejs/types/output.ts index 498e339ca2..78bfc3c0f6 100644 --- a/sdk/nodejs/types/output.ts +++ b/sdk/nodejs/types/output.ts @@ -16129,7 +16129,7 @@ export namespace lambda { /** * The source code of your Lambda function. If you include your function source inline with this parameter, AWS CloudFormation places it in a file named index and zips it to create a deployment package.. */ - zipFile?: string; + zipFile?: pulumi.asset.Asset | pulumi.asset.Archive; } /** diff --git a/sdk/python/pulumi_aws_native/lambda_/_inputs.py b/sdk/python/pulumi_aws_native/lambda_/_inputs.py index 8d3909923f..cd517e20d3 100644 --- a/sdk/python/pulumi_aws_native/lambda_/_inputs.py +++ b/sdk/python/pulumi_aws_native/lambda_/_inputs.py @@ -344,13 +344,13 @@ def __init__(__self__, *, s3_bucket: Optional[pulumi.Input[str]] = None, s3_key: Optional[pulumi.Input[str]] = None, s3_object_version: Optional[pulumi.Input[str]] = None, - zip_file: Optional[pulumi.Input[str]] = None): + zip_file: Optional[pulumi.Input[Union[pulumi.Asset, pulumi.Archive]]] = None): """ :param pulumi.Input[str] image_uri: ImageUri. :param pulumi.Input[str] s3_bucket: An Amazon S3 bucket in the same AWS Region as your function. The bucket can be in a different AWS account. :param pulumi.Input[str] s3_key: The Amazon S3 key of the deployment package. :param pulumi.Input[str] s3_object_version: For versioned objects, the version of the deployment package object to use. - :param pulumi.Input[str] zip_file: The source code of your Lambda function. If you include your function source inline with this parameter, AWS CloudFormation places it in a file named index and zips it to create a deployment package.. + :param pulumi.Input[Union[pulumi.Asset, pulumi.Archive]] zip_file: The source code of your Lambda function. If you include your function source inline with this parameter, AWS CloudFormation places it in a file named index and zips it to create a deployment package.. """ if image_uri is not None: pulumi.set(__self__, "image_uri", image_uri) @@ -413,14 +413,14 @@ def s3_object_version(self, value: Optional[pulumi.Input[str]]): @property @pulumi.getter(name="zipFile") - def zip_file(self) -> Optional[pulumi.Input[str]]: + def zip_file(self) -> Optional[pulumi.Input[Union[pulumi.Asset, pulumi.Archive]]]: """ The source code of your Lambda function. If you include your function source inline with this parameter, AWS CloudFormation places it in a file named index and zips it to create a deployment package.. """ return pulumi.get(self, "zip_file") @zip_file.setter - def zip_file(self, value: Optional[pulumi.Input[str]]): + def zip_file(self, value: Optional[pulumi.Input[Union[pulumi.Asset, pulumi.Archive]]]): pulumi.set(self, "zip_file", value) diff --git a/sdk/python/pulumi_aws_native/lambda_/outputs.py b/sdk/python/pulumi_aws_native/lambda_/outputs.py index 8dc13b561f..700eca0424 100644 --- a/sdk/python/pulumi_aws_native/lambda_/outputs.py +++ b/sdk/python/pulumi_aws_native/lambda_/outputs.py @@ -484,13 +484,13 @@ def __init__(__self__, *, s3_bucket: Optional[str] = None, s3_key: Optional[str] = None, s3_object_version: Optional[str] = None, - zip_file: Optional[str] = None): + zip_file: Optional[Union[pulumi.Asset, pulumi.Archive]] = None): """ :param str image_uri: ImageUri. :param str s3_bucket: An Amazon S3 bucket in the same AWS Region as your function. The bucket can be in a different AWS account. :param str s3_key: The Amazon S3 key of the deployment package. :param str s3_object_version: For versioned objects, the version of the deployment package object to use. - :param str zip_file: The source code of your Lambda function. If you include your function source inline with this parameter, AWS CloudFormation places it in a file named index and zips it to create a deployment package.. + :param Union[pulumi.Asset, pulumi.Archive] zip_file: The source code of your Lambda function. If you include your function source inline with this parameter, AWS CloudFormation places it in a file named index and zips it to create a deployment package.. """ if image_uri is not None: pulumi.set(__self__, "image_uri", image_uri) @@ -537,7 +537,7 @@ def s3_object_version(self) -> Optional[str]: @property @pulumi.getter(name="zipFile") - def zip_file(self) -> Optional[str]: + def zip_file(self) -> Optional[Union[pulumi.Asset, pulumi.Archive]]: """ The source code of your Lambda function. If you include your function source inline with this parameter, AWS CloudFormation places it in a file named index and zips it to create a deployment package.. """