Created
September 25, 2018 12:30
-
-
Save Tirke/fba6d1bf95674f51922a6b808f04561c to your computer and use it in GitHub Desktop.
Epsagon + Pulumi
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// @ts-ignore | |
import * as epsagon from '@epsagon/epsagon' | |
import * as pulumi from '@pulumi/pulumi' | |
import * as aws from '@pulumi/aws' | |
import * as serverless from '@pulumi/aws-serverless' | |
const config = new pulumi.Config('epsagon') | |
const epsToken = config.require('token') | |
const hello = new aws.serverless.Function('hello', { | |
factoryFunc: () => { | |
epsagon.init({ | |
token: process.env.EPSAGON_TOKEN, | |
appName: `pulumi`, | |
metadataOnly: false | |
}) | |
return epsagon.lambdaWrapper(() => { | |
return { | |
body: 'hello' | |
} | |
}) | |
}, | |
environment: { | |
variables: { | |
'EPSAGON_TOKEN': epsToken | |
} | |
}, | |
policies: ['arn:aws:iam::aws:policy/AWSLambdaFullAccess'] | |
}) | |
const api = new serverless.apigateway.API('api', { | |
routes: [ | |
{method: 'GET', path: '/hello', handler: hello.lambda} | |
] | |
}) | |
export const url = api.url.apply(url => `${url}hello`) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment