This file contains hidden or 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
service: init-user | |
frameworkVersion: '2' | |
provider: | |
name: aws | |
runtime: nodejs12.x | |
functions: | |
hello: | |
handler: handler.initUser |
This file contains hidden or 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
language: node_js | |
node_js: | |
- "10" | |
cache: | |
directories: | |
- node_modules | |
- ${SERVICE_PATH}/node_modules | |
install: | |
- yarn global add serverless | |
- travis_retry yarn install |
This file contains hidden or 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
#!/usr/bin/env bash | |
cd ${SERVICE_PATH} | |
serverless deploy -s ${STAGE_NAME} | |
cd - |
This file contains hidden or 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
const handler = require('../handler'); | |
test('correctly create post', () => { | |
expect(handler.createPost({foo: 'bar'})).toStrictEqual({ | |
statusCode: 200, | |
body: JSON.stringify( | |
{ | |
message: 'Hello From Create Post!', | |
input: {foo: 'bar'}, | |
}, |
This file contains hidden or 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
'use strict'; | |
module.exports.createPost = event => { | |
return { | |
statusCode: 200, | |
body: JSON.stringify( | |
{ | |
message: 'Hello From Create Post!', | |
input: event, | |
}, |
This file contains hidden or 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
resource "aws_security_group" "instance" { | |
name = "openvpn-default" | |
description = "OpenVPN security group" | |
ingress { | |
from_port = 22 | |
to_port = 22 | |
protocol = "tcp" | |
cidr_blocks = ["0.0.0.0/0"] | |
} |
This file contains hidden or 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
resource "aws_instance" "openvpn" { | |
ami = local.images[var.server_region] | |
instance_type = "t2.micro" | |
vpc_security_group_ids = [aws_security_group.instance.id] | |
user_data = <<-EOF | |
admin_user=${var.server_username} | |
admin_pw=${var.server_password} | |
EOF |
This file contains hidden or 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
locals { | |
images = { | |
us-east-1 = "ami-037ff6453f0855c46" | |
eu-central-1 = "ami-0764964fdfe99bc31" | |
ap-northeast-1 = "ami-04f47c2ec43830d77" | |
} | |
} |
This file contains hidden or 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
output "access_vpn_url" { | |
value = "https://${aws_instance.openvpn.public_ip}:943/admin" | |
description = "The public url address of the vpn server" | |
} |
This file contains hidden or 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
provider "aws" { | |
region = var.server_region | |
} |
NewerOlder