Skip to content

Commit

Permalink
fix: set lambda in a vpc
Browse files Browse the repository at this point in the history
  • Loading branch information
hfreire committed May 23, 2019
1 parent 4c6bd87 commit 6d993c1
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 43 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#
# A :construction_worker: handyman to take care of your :octocat: GitHub :construction: side work

[![Build Status](https://travis-ci.org/hfreire/github-handyman.svg?branch=master)](https://travis-ci.org/hfreire/github-handyman)
[![Coverage Status](https://coveralls.io/repos/github/hfreire/github-handyman/badge.svg?branch=master)](https://coveralls.io/github/hfreire/github-handyman?branch=master)
Expand Down
52 changes: 14 additions & 38 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,11 @@
"coveralls": "cat ./coverage/lcov.info | ./node_modules/.bin/coveralls",
"semantic-release": "./node_modules/.bin/semantic-release",
"serverless:package": "./node_modules/.bin/serverless package",
"serverless:deploy": "./node_modules/.bin/serverless deploy -s production",
"serverless:deploy:function": "npm run compile && ./node_modules/.bin/serverless deploy -f handler -s production",
"serverless:undeploy": "./node_modules/.bin/serverless remove -s production",
"serverless:invoke": "npm run compile && ./node_modules/.bin/serverless invoke -l -f handler -s production",
"serverless:deploy": "./node_modules/.bin/serverless deploy",
"serverless:deploy:test": "./node_modules/.bin/serverless deploy --noDeploy",
"serverless:deploy:function": "npm run compile && ./node_modules/.bin/serverless deploy -f handler",
"serverless:undeploy": "./node_modules/.bin/serverless remove",
"serverless:invoke": "npm run compile && ./node_modules/.bin/serverless invoke -l -f handler",
"serverless:invoke:local": "npm run compile && ./node_modules/.bin/serverless invoke local -f handler",
"clean": "rm -rf build coverage",
"lint": "npm run eslint",
Expand Down
4 changes: 4 additions & 0 deletions serverless.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,13 @@ frameworkVersion: ">=1.1.0 <2.0.0"

provider:
name: aws
stage: ${opt:stage, 'production'}
runtime: nodejs8.10
region: ${file(share/terraform/terraform.json):aws_region}
memorySize: 128
vpc:
subnetIds: ${file(share/terraform/terraform.json):aws_subnet_ids}
securityGroupIds: ${file(share/terraform/terraform.json):aws_security_group_ids}
environment:
GH_TOKEN: ${env:GH_TOKEN}
GH_ORGS: ${env:GH_ORGS}
Expand Down
15 changes: 15 additions & 0 deletions share/terraform/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,18 @@ data "aws_vpc" "selected" {
Name = "${var.infrastructure_name}"
}
}

data "aws_subnet_ids" "selected" {
vpc_id = "${data.aws_vpc.selected.id}"

tags {
IsPrivateSubnet = true
}
}

data "aws_security_groups" "selected" {
tags = {
IsAntifragile = true
Name = "serverless"
}
}
12 changes: 12 additions & 0 deletions share/terraform/output.tf
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,15 @@ output "aws_vpc_id" {

sensitive = true
}

output "aws_subnet_ids" {
value = "${data.aws_subnet_ids.selected.ids}"

sensitive = true
}

output "aws_security_group_ids" {
value = "${data.aws_security_groups.selected.ids}"

sensitive = true
}

0 comments on commit 6d993c1

Please sign in to comment.