Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

main.tf 1.8 KB

You have to be logged in to leave a comment. Sign In
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
  1. terraform {
  2. cloud {
  3. organization = "PavloFesenko"
  4. workspaces {
  5. tags = ["gif_analyzer"]
  6. }
  7. }
  8. }
  9. provider "aws" {
  10. region = "eu-west-3"
  11. }
  12. variable "project" {
  13. type = string
  14. }
  15. variable "env" {
  16. type = string
  17. }
  18. module "lambda_function" {
  19. source = "terraform-aws-modules/lambda/aws"
  20. function_name = "${var.project}_${var.env}"
  21. source_path = "scripts"
  22. handler = "app.handler"
  23. runtime = "python3.10"
  24. timeout = 30
  25. memory_size = 1024
  26. create_lambda_function_url = true
  27. environment_variables = {
  28. ENV = "aws"
  29. }
  30. layers = [
  31. module.layer_api.lambda_layer_arn,
  32. module.layer_core.lambda_layer_arn,
  33. module.layer_model.lambda_layer_arn
  34. ]
  35. }
  36. module "layer_api" {
  37. source = "terraform-aws-modules/lambda/aws"
  38. create_function = false
  39. create_layer = true
  40. layer_name = "${var.project}_${var.env}_api"
  41. compatible_runtimes = ["python3.10"]
  42. build_in_docker = true
  43. runtime = "python3.10"
  44. source_path = [
  45. {
  46. path = "layers/api"
  47. pip_requirements = true
  48. prefix_in_zip = "python"
  49. }
  50. ]
  51. }
  52. module "layer_core" {
  53. source = "terraform-aws-modules/lambda/aws"
  54. create_function = false
  55. create_layer = true
  56. layer_name = "${var.project}_${var.env}_core"
  57. compatible_runtimes = ["python3.10"]
  58. build_in_docker = true
  59. runtime = "python3.10"
  60. source_path = [
  61. {
  62. path = "layers/core"
  63. pip_requirements = true
  64. prefix_in_zip = "python"
  65. }
  66. ]
  67. }
  68. module "layer_model" {
  69. source = "terraform-aws-modules/lambda/aws"
  70. create_function = false
  71. create_layer = true
  72. layer_name = "${var.project}_${var.env}_model"
  73. compatible_runtimes = ["python3.10"]
  74. source_path = "layers/model"
  75. }
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...