Skip to content

Commit

Permalink
Merge pull request #52 from fujiwara/efs-support
Browse files Browse the repository at this point in the history
EFS support
  • Loading branch information
fujiwara authored Jun 17, 2020
2 parents e4075db + 156dbf2 commit 3792043
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 23 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,12 @@ function.json is a definition for Lambda function. JSON structure is based from
}
},
"FunctionName": "{{ must_env `ENV` }}-hello",
"FileSystemConfigs": [
{
"Arn": "arn:aws:elasticfilesystem:ap-northeast-1:123456789012:access-point/fsap-04fc0858274e7dd9a",
"LocalMountPath": "/mnt/lambda"
}
],
"Handler": "index.js",
"MemorySize": 128,
"Role": "arn:aws:iam::123456789012:role/hello_lambda_function",
Expand Down
27 changes: 14 additions & 13 deletions deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,19 +98,20 @@ func (app *App) Deploy(opt DeployOption) error {

log.Println("[info] updating function configuration", opt.label())
confIn := &lambda.UpdateFunctionConfigurationInput{
DeadLetterConfig: fn.DeadLetterConfig,
Description: fn.Description,
Environment: fn.Environment,
FunctionName: fn.FunctionName,
Handler: fn.Handler,
KMSKeyArn: fn.KMSKeyArn,
Layers: fn.Layers,
MemorySize: fn.MemorySize,
Role: fn.Role,
Runtime: fn.Runtime,
Timeout: fn.Timeout,
TracingConfig: fn.TracingConfig,
VpcConfig: fn.VpcConfig,
DeadLetterConfig: fn.DeadLetterConfig,
Description: fn.Description,
Environment: fn.Environment,
FunctionName: fn.FunctionName,
FileSystemConfigs: fn.FileSystemConfigs,
Handler: fn.Handler,
KMSKeyArn: fn.KMSKeyArn,
Layers: fn.Layers,
MemorySize: fn.MemorySize,
Role: fn.Role,
Runtime: fn.Runtime,
Timeout: fn.Timeout,
TracingConfig: fn.TracingConfig,
VpcConfig: fn.VpcConfig,
}
log.Printf("[debug]\n%s", confIn.String())

Expand Down
3 changes: 3 additions & 0 deletions function_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,8 @@ func TestLoadFunction(t *testing.T) {
if *fn.FunctionName != "test" {
t.Errorf("unexpected function name got %s", *fn.FunctionName)
}
if *fn.FileSystemConfigs[0].Arn != "arn:aws:elasticfilesystem:ap-northeast-1:123456789012:access-point/fsap-04fc0858274e7dd9a" {
t.Errorf("unexpected fileSystemConfigs %v", *&fn.FileSystemConfigs)
}
t.Log(fn.String())
}
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ go 1.13
require (
github.com/Songmu/prompter v0.3.0
github.com/alecthomas/kingpin v2.2.6+incompatible
github.com/aws/aws-sdk-go v1.30.26
github.com/aws/aws-sdk-go v1.32.3
github.com/go-test/deep v1.0.6
github.com/hashicorp/logutils v1.0.0
github.com/kayac/go-config v0.3.2
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuy
github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d h1:UQZhZ2O0vMHr2cI+DC1Mbh0TJxzA3RcLoMsFw+aXw7E=
github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho=
github.com/aws/aws-sdk-go v1.30.7/go.mod h1:5zCpMtNQVjRREroY7sYe8lOMRSxkhG6MZveU8YkpAk0=
github.com/aws/aws-sdk-go v1.30.26 h1:wP0N6DBb/3EyHTtWNz4jzgGVi1l290zoFGfu4HFGeM0=
github.com/aws/aws-sdk-go v1.30.26/go.mod h1:5zCpMtNQVjRREroY7sYe8lOMRSxkhG6MZveU8YkpAk0=
github.com/aws/aws-sdk-go v1.32.3 h1:E3OciOGVlJrv1gQ2T7/Oou+I9nGPB2j978THQjvZBf0=
github.com/aws/aws-sdk-go v1.32.3/go.mod h1:5zCpMtNQVjRREroY7sYe8lOMRSxkhG6MZveU8YkpAk0=
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
Expand Down
17 changes: 10 additions & 7 deletions lambroll.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,13 +132,16 @@ func (app *App) loadFunction(path string) (*Function, error) {

func newFuctionFrom(c *lambda.FunctionConfiguration, tags Tags) *Function {
fn := &Function{
Description: c.Description,
FunctionName: c.FunctionName,
Handler: c.Handler,
MemorySize: c.MemorySize,
Role: c.Role,
Runtime: c.Runtime,
Timeout: c.Timeout,
Description: c.Description,
FunctionName: c.FunctionName,
Handler: c.Handler,
MemorySize: c.MemorySize,
Role: c.Role,
Runtime: c.Runtime,
Timeout: c.Timeout,
DeadLetterConfig: c.DeadLetterConfig,
FileSystemConfigs: c.FileSystemConfigs,
KMSKeyArn: c.KMSKeyArn,
}
if e := c.Environment; e != nil {
fn.Environment = &lambda.Environment{
Expand Down
6 changes: 6 additions & 0 deletions test/function.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
{
"Description": "hello function",
"FunctionName": "{{ must_env `FUNCTION_NAME` }}",
"FileSystemConfigs": [
{
"Arn": "arn:aws:elasticfilesystem:ap-northeast-1:123456789012:access-point/fsap-04fc0858274e7dd9a",
"LocalMountPath": "/mnt/lambda"
}
],
"Handler": "index.js",
"MemorySize": 128,
"Role": "{{ tfstate `data.aws_iam_role.lambda.arn` }}",
Expand Down

0 comments on commit 3792043

Please sign in to comment.