FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
lambda-scraper/module/lambda-proxy.tf at main · rev183/lambda-scraper · GitHub
rev183
/
lambda-scraper
Public
forked from
teticio/lambda-scraper
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
lambda-scraper
/
module
/
lambda-proxy.tf
Copy path
More file actions
More file actions
Latest commit
History
History
History
144 lines (128 loc) · 3.95 KB
Breadcrumbs
lambda-scraper
/
module
/
lambda-proxy.tf
Copy path
File metadata and controls
144 lines (128 loc) · 3.95 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
terraform
{
required_providers
{
aws
=
{
source
=
"
hashicorp/aws
"
}
docker
=
{
source
=
"
kreuzwerker/docker
"
}
}
}
module
"lambda_proxy_i"
{
source
=
"
terraform-aws-modules/lambda/aws
"
count
=
var
.
num_proxies
function_name
=
"
proxy-
${
count
.
index
}
"
create_package
=
false
image_uri
=
module
.
ecr_proxy_i
.
image_uri
package_type
=
"
Image
"
timeout
=
600
publish
=
true
#
Use the shared IAM role
create_role
=
false
lambda_role
=
var
.
lambda_role_arn
}
resource
"local_file"
"proxy_urls"
{
content
=
jsonencode
(aws_lambda_function_url
.
lambda_proxy_i
[
*
]
.
function_url
)
filename
=
"
${
path
.
module
}
/../lambda/proxy-urls-
${
var
.
region
}
-
${
var
.
aws_profile
}
.json
"
}
module
"lambda_proxy"
{
source
=
"
terraform-aws-modules/lambda/aws
"
function_name
=
"
proxy
"
create_package
=
false
image_uri
=
module
.
ecr_proxy
.
image_uri
package_type
=
"
Image
"
timeout
=
600
publish
=
true
attach_policy_json
=
true
role_name
=
"
proxy-
${
var
.
region
}
"
environment_variables
=
{
PROXY_URLS_FILE_NAME
=
"
proxy-urls-
${
var
.
region
}
-
${
var
.
aws_profile
}
.json
"
}
policy_json
=
jsonencode
({
Version
=
"
2012-10-17
"
Statement
=
[{
Effect
=
"
Allow
"
Action
=
"
lambda:InvokeFunctionUrl
"
Resource
=
replace
(aws_lambda_function_url
.
lambda_proxy_i
[
0
]
.
function_arn
,
"
-0
"
,
"
-*
"
)
}]
})
}
module
"ecr_proxy_i"
{
source
=
"
terraform-aws-modules/lambda/aws//modules/docker-build
"
create_ecr_repo
=
true
ecr_repo
=
"
lambda-proxy-i
"
source_path
=
"
${
path
.
module
}
/../lambda
"
docker_file_path
=
"
Dockerfile-i
"
platform
=
"
linux/amd64
"
image_tag
=
sha1
(
join
(
"
"
, [
filesha1
(
"
${
path
.
module
}
/../lambda/package.json
"
),
filesha1
(
"
${
path
.
module
}
/../lambda/proxy-i.js
"
),
filesha1
(
"
${
path
.
module
}
/../lambda/Dockerfile-i
"
),
]))
ecr_repo_lifecycle_policy
=
jsonencode
({
"
rules
"
:
[
{
"
rulePriority
"
:
1
,
"
description
"
:
"
Keep only the last 1 image
"
,
"
selection
"
:
{
"
tagStatus
"
:
"
any
"
,
"
countType
"
:
"
imageCountMoreThan
"
,
"
countNumber
"
:
1
},
"
action
"
:
{
"
type
"
:
"
expire
"
}
}
]
})
}
module
"ecr_proxy"
{
source
=
"
terraform-aws-modules/lambda/aws//modules/docker-build
"
create_ecr_repo
=
true
ecr_repo
=
"
lambda-proxy-
${
var
.
region
}
"
source_path
=
"
${
path
.
module
}
/../lambda
"
docker_file_path
=
"
Dockerfile
"
platform
=
"
linux/amd64
"
depends_on
=
[
local_file
.
proxy_urls
]
build_args
=
{
PROXY_URLS_FILE_NAME
=
"
proxy-urls-
${
var
.
region
}
-
${
var
.
aws_profile
}
.json
"
}
image_tag
=
sha1
(
join
(
"
"
, [
filesha1
(
"
${
path
.
module
}
/../lambda/package.json
"
),
filesha1
(
"
${
path
.
module
}
/../lambda/proxy.js
"
),
fileexists
(
"
${
path
.
module
}
/../lambda/proxy-urls-
${
var
.
region
}
-
${
var
.
aws_profile
}
.json
"
)
?
filesha1
(
"
${
path
.
module
}
/../lambda/proxy-urls-
${
var
.
region
}
-
${
var
.
aws_profile
}
.json
"
)
:
"
"
,
filesha1
(
"
${
path
.
module
}
/../lambda/Dockerfile
"
),
]))
ecr_repo_lifecycle_policy
=
jsonencode
({
"
rules
"
:
[
{
"
rulePriority
"
:
1
,
"
description
"
:
"
Keep only the last 1 image
"
,
"
selection
"
:
{
"
tagStatus
"
:
"
any
"
,
"
countType
"
:
"
imageCountMoreThan
"
,
"
countNumber
"
:
1
},
"
action
"
:
{
"
type
"
:
"
expire
"
}
}
]
})
}
resource
"aws_lambda_function_url"
"lambda_proxy_i"
{
count
=
var
.
num_proxies
function_name
=
module
.
lambda_proxy_i
[
count
.
index
]
.
lambda_function_name
authorization_type
=
"
AWS_IAM
"
invoke_mode
=
"
RESPONSE_STREAM
"
}
resource
"aws_lambda_function_url"
"lambda_proxy"
{
function_name
=
module
.
lambda_proxy
.
lambda_function_name
authorization_type
=
"
NONE
"
invoke_mode
=
"
RESPONSE_STREAM
"
}
variable
"num_proxies"
{}
variable
"region"
{}
variable
"lambda_role_arn"
{
type
=
string
}
Back
|
FazBrowse Home
|
New Git URL