Skip to content

Commit 852e725

Browse files
authored
feat: Added Lambda, API Gateway, CloudFront modules, and some refactoring (#60)
1 parent 0163081 commit 852e725

File tree

144 files changed

+7149
-10971
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

144 files changed

+7149
-10971
lines changed

.gitignore

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ var/
2020
# Serverless directories
2121
.serverless
2222

23-
2423
.requirements-cache
2524
node_modules
2625
output/*
@@ -30,3 +29,30 @@ graph.png
3029

3130
/.venv
3231
/.idea
32+
33+
# Terraform
34+
.terraform
35+
.terragrunt-cache
36+
*.tfstate*
37+
.terraform.lock.hcl
38+
crash.log
39+
40+
# OS X
41+
.history
42+
.DS_Store
43+
44+
# IntelliJ
45+
.idea_modules
46+
*.iml
47+
*.iws
48+
*.ipr
49+
.idea/
50+
build/
51+
*/build/
52+
out/
53+
54+
# Lambda builds by Terraform AWS Lambda module
55+
builds/
56+
57+
# Vim
58+
*.sw[op]

.pre-commit-config.yaml

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,25 @@
11
repos:
2-
- repo: git://github.com/doublify/pre-commit-isort
2+
- repo: https://github.com/doublify/pre-commit-isort
33
rev: v4.3.0
44
hooks:
55
- id: isort
6-
- repo: git://github.com/pre-commit/pre-commit-hooks
7-
rev: v2.5.0
6+
- repo: https://github.com/pre-commit/pre-commit-hooks
7+
rev: v3.4.0
88
hooks:
99
- id: check-ast
1010
- id: check-merge-conflict
1111
- id: requirements-txt-fixer
1212
- id: end-of-file-fixer
13+
- repo: https://gitlab.com/pycqa/flake8
14+
rev: 3.9.2
15+
hooks:
1316
- id: flake8
14-
#- repo: git://github.com/codespell-project/codespell
15-
# rev: v1.16.0
16-
# hooks:
17-
# - id: codespell
17+
- repo: https://github.com/antonbabenko/pre-commit-terraform
18+
rev: v1.50.0
19+
hooks:
20+
- id: terraform_fmt
21+
- id: terraform_docs
22+
- repo: https://github.com/pre-commit/pre-commit-hooks
23+
rev: v3.4.0
24+
hooks:
25+
- id: check-merge-conflict

.vscode/launch.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"configurations": [
3+
{
4+
"name": "Python: src/handler.py",
5+
"type": "python",
6+
"request": "launch",
7+
"program": "src/handler.py",
8+
"console": "integratedTerminal",
9+
"cwd": "${workspaceFolder}"
10+
},
11+
{
12+
"name": "Python: Current File",
13+
"type": "python",
14+
"request": "launch",
15+
"program": "${file}",
16+
"console": "integratedTerminal"
17+
}
18+
]
19+
}

.vscode/settings.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"python.pythonPath": "/Users/Bob/.local/share/virtualenvs/modules.tf-diagrams/bin/python",
3+
"python.linting.enabled": true,
4+
"python.linting.flake8Enabled": true,
5+
"python.formatting.provider": "autopep8"
6+
}

DEVELOPMENT.md

Lines changed: 0 additions & 50 deletions
This file was deleted.

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright (c) 2018 Anton Babenko
3+
Copyright (c) 2018-2021 Anton Babenko
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
66

README.md

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
1-
# modules.tf - Infrastructure as code generator - from visual diagrams to Terraform
1+
# Diagrams to code (d2c) - Infrastructure as code generator - from visual diagrams to Terraform
22

33
[![Financial Contributors on Open Collective](https://opencollective.com/modulestf/all/badge.svg?label=financial+contributors)](https://opencollective.com/modulestf) [![MIT license](https://img.shields.io/github/license/antonbabenko/modules.tf-lambda.svg)]() [![@antonbabenko](https://img.shields.io/twitter/follow/antonbabenko.svg?style=flat&label=Follow%20@antonbabenko%20on%20Twitter)](https://twitter.com/antonbabenko)
44

5-
65
<a href="https://github.com/antonbabenko/modules.tf-lambda"><img src="https://raw.githubusercontent.com/antonbabenko/modules.tf-lambda/master/misc/modulestf-logo.png" alt="modules.tf - Infrastructure as code generator - from visual diagrams to Terraform" width="210" height="70" align="right" /></a>
76

87
Code in this repository is used for generating infrastructure as Terraform configurations from visual diagrams created using [Cloudcraft](https://www.cloudcraft.co).
98

10-
[modules.tf](https://github.com/antonbabenko/modules.tf-lambda) is an open-source project by [Anton Babenko](https://github.com/antonbabenko).
11-
129

1310
## How can I try this?
1411

@@ -37,8 +34,6 @@ In [modules.tf-demo](https://github.com/antonbabenko/modules.tf-demo) repository
3734

3835
This project was partially sponsored by [Cloudcraft - the best way to draw AWS diagrams](https://www.cloudcraft.co).<br clear="all">
3936

40-
Monitoring of serverless applications provided by [Thundra](https://www.thundra.io/).
41-
4237
[Become a sponsor to @antonbabenko on GitHub](https://github.com/sponsors/antonbabenko/).
4338

4439
[![@antonbabenko](https://img.shields.io/twitter/follow/antonbabenko.svg?style=flat&label=Follow%20@antonbabenko%20on%20Twitter)](https://twitter.com/antonbabenko)
@@ -48,11 +43,26 @@ Monitoring of serverless applications provided by [Thundra](https://www.thundra.
4843

4944
## Developer's guide
5045

51-
This project is Python 3.7 application written using [Serverless framework](https://serverless.com) which runs on [AWS Lambda](https://aws.amazon.com/lambda/).
46+
This project is Python 3.8 serverless application written using [serverless.tf](https://serverless.tf) framework and open-source components ([Terraform AWS modules](https://github.com/terraform-aws-modules)).
47+
48+
### Notes for developers
49+
50+
Terraform is used to provision infrastructure resources as well as packaging artifacts and to do the deployments (check out [serverless.tf](https://serverless.tf) for more details).
51+
52+
Source code is located in `src/handler.py`.
53+
54+
Go to directory `terraform`, verify/update file `terraform.tfvars` and run:
55+
56+
```
57+
$ terraform init # Download required Terraform providers and modules
58+
$ terraform apply # Create or update infrastructure resources or do a new deployment of Lambda function (if source code has changed)
59+
```
5260

53-
Read [official quick start guide](https://serverless.com/framework/docs/providers/aws/guide/quick-start/) and [installation instructions](https://serverless.com/framework/docs/providers/aws/guide/installation/) to familiarise yourself with it.
61+
When infrastructure is created, you should be able to `POST` using [httpie](https://github.com/jakubroztocil/httpie/) or `curl` like this:
5462

55-
Read [DEVELOPMENT.md](https://github.com/antonbabenko/modules.tf-lambda/blob/master/DEVELOPMENT.md) for more insights if you want to contribute to this project.
63+
```
64+
$ http --print Hhb --all --follow https://dev-d2c.modules.tf @test_fixtures/input/blueprint_my.json
65+
```
5666

5767

5868
## Contributors
@@ -89,4 +99,4 @@ Support this project with your organization. Your logo will show up here with a
8999

90100
This work is licensed under MIT License. See LICENSE for full details.
91101

92-
Copyright (c) 2019 Anton Babenko
102+
Copyright (c) 2018-2021 Anton Babenko

bin/test_lambda_local.sh

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)