UNPKG

@knapsack/app

Version:

Build Design Systems on top of knapsack, by Basalt

201 lines (200 loc) 4.64 kB
{ "AWSTemplateFormatVersion": "2010-09-09", "Description": "Lambda resource stack creation using Amplify CLI", "Parameters": { "GROUP": { "Type": "String", "Default": "" }, "modules": { "Type": "String", "Default": "", "Description": "Comma-delimmited list of modules to be executed by a lambda trigger. Sent to resource as an env variable." }, "resourceName": { "Type": "String", "Default": "" }, "trigger": { "Type": "String", "Default": "true" }, "functionName": { "Type": "String", "Default": "" }, "roleName": { "Type": "String", "Default": "" }, "parentResource": { "Type": "String", "Default": "" }, "parentStack": { "Type": "String", "Default": "" }, "env": { "Type": "String" } }, "Conditions": { "ShouldNotCreateEnvResources": { "Fn::Equals": [ { "Ref": "env" }, "NONE" ] } }, "Resources": { "LambdaFunction": { "Type": "AWS::Lambda::Function", "Metadata": { "aws:asset:path": "./src", "aws:asset:property": "Code" }, "Properties": { "Handler": "index.handler", "FunctionName": { "Fn::If": [ "ShouldNotCreateEnvResources", "KsUsersPostConfirmation", { "Fn::Join": [ "", [ "KsUsersPostConfirmation", "-", { "Ref": "env" } ] ] } ] }, "Environment": { "Variables": { "ENV": { "Ref": "env" }, "MODULES": { "Ref": "modules" }, "REGION": { "Ref": "AWS::Region" }, "GROUP": { "Ref": "GROUP" } } }, "Role": { "Fn::GetAtt": ["LambdaExecutionRole", "Arn"] }, "Runtime": "nodejs8.10", "Timeout": "25", "Code": { "S3Bucket": "amplify-knapsack-local-162428-deployment", "S3Key": "amplify-builds/KsUsersPostConfirmation-65445677424543784f50-build.zip" } } }, "LambdaExecutionRole": { "Type": "AWS::IAM::Role", "Properties": { "RoleName": { "Fn::If": [ "ShouldNotCreateEnvResources", "KsUsersPostConfirmation", { "Fn::Join": [ "", [ "KsUsersPostConfirmation", "-", { "Ref": "env" } ] ] } ] }, "AssumeRolePolicyDocument": { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Principal": { "Service": ["lambda.amazonaws.com"] }, "Action": ["sts:AssumeRole"] } ] } } }, "lambdaexecutionpolicy": { "DependsOn": ["LambdaExecutionRole"], "Type": "AWS::IAM::Policy", "Properties": { "PolicyName": "lambda-execution-policy", "Roles": [ { "Ref": "LambdaExecutionRole" } ], "PolicyDocument": { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "logs:CreateLogGroup", "logs:CreateLogStream", "logs:PutLogEvents" ], "Resource": { "Fn::Sub": [ "arn:aws:logs:${region}:${account}:log-group:/aws/lambda/${lambda}:log-stream:*", { "region": { "Ref": "AWS::Region" }, "account": { "Ref": "AWS::AccountId" }, "lambda": { "Ref": "LambdaFunction" } } ] } } ] } } } }, "Outputs": { "Name": { "Value": { "Ref": "LambdaFunction" } }, "Arn": { "Value": { "Fn::GetAtt": ["LambdaFunction", "Arn"] } }, "Region": { "Value": { "Ref": "AWS::Region" } } } }