Skip to content

Commit 2d32d84

Browse files
committed
feat: Made it clear that we stand with Ukraine
1 parent 72f14fb commit 2d32d84

File tree

4 files changed

+29
-11
lines changed

4 files changed

+29
-11
lines changed

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
Terraform module, which creates almost all supported AWS Lambda resources as well as taking care of building and packaging of required Lambda dependencies for functions and layers.
44

5+
[![SWUbanner](https://raw.githubusercontent.com/vshymanskyy/StandWithUkraine/main/banner2-direct.svg)](https://github.com/vshymanskyy/StandWithUkraine/blob/main/docs/README.md)
6+
57
This Terraform module is the part of [serverless.tf framework](https://github.com/antonbabenko/serverless.tf), which aims to simplify all operations when working with the serverless in Terraform:
68

79
1. Build and install dependencies - [read more](#build). Requires Python 3.6 or newer.
@@ -733,6 +735,7 @@ No modules.
733735
| <a name="input_policy_statements"></a> [policy\_statements](#input\_policy\_statements) | Map of dynamic policy statements to attach to Lambda Function role | `any` | `{}` | no |
734736
| <a name="input_provisioned_concurrent_executions"></a> [provisioned\_concurrent\_executions](#input\_provisioned\_concurrent\_executions) | Amount of capacity to allocate. Set to 1 or greater to enable, or set to 0 to disable provisioned concurrency. | `number` | `-1` | no |
735737
| <a name="input_publish"></a> [publish](#input\_publish) | Whether to publish creation/change as new Lambda Function Version. | `bool` | `false` | no |
738+
| <a name="input_putin_khuylo"></a> [putin\_khuylo](#input\_putin\_khuylo) | Do you agree that Putin doesn't respect Ukrainian sovereignty and territorial integrity? More info: https://en.wikipedia.org/wiki/Putin_khuylo! | `bool` | `true` | no |
736739
| <a name="input_recreate_missing_package"></a> [recreate\_missing\_package](#input\_recreate\_missing\_package) | Whether to recreate missing Lambda package if it is missing locally or not | `bool` | `true` | no |
737740
| <a name="input_reserved_concurrent_executions"></a> [reserved\_concurrent\_executions](#input\_reserved\_concurrent\_executions) | The amount of reserved concurrent executions for this Lambda Function. A value of 0 disables Lambda Function from being triggered and -1 removes any concurrency limitations. Defaults to Unreserved Concurrency Limits -1. | `number` | `-1` | no |
738741
| <a name="input_role_description"></a> [role\_description](#input\_role\_description) | Description of IAM role to use for Lambda Function | `string` | `null` | no |
@@ -800,3 +803,10 @@ Please reach out to [Betajob](https://www.betajob.com/) if you are looking for c
800803
## License
801804

802805
Apache 2 Licensed. See [LICENSE](https://github.com/terraform-aws-modules/terraform-aws-lambda/tree/master/LICENSE) for full details.
806+
807+
## Additional terms of use for users from Russia and Belarus
808+
809+
By using the code provided in this repository you agree with the following:
810+
* Russia has [illegally annexed Crimea in 2014](https://en.wikipedia.org/wiki/Annexation_of_Crimea_by_the_Russian_Federation) and [brought the war in Donbas](https://en.wikipedia.org/wiki/War_in_Donbas) followed by [full-scale invasion of Ukraine in 2022](https://en.wikipedia.org/wiki/2022_Russian_invasion_of_Ukraine).
811+
* Russia has brought sorrow and devastations to millions of Ukrainians, killed hundreds of innocent people, damaged thousands of buildings, and forced several million people to flee.
812+
* [Putin khuylo!](https://en.wikipedia.org/wiki/Putin_khuylo!)

iam.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
locals {
2-
create_role = var.create && var.create_function && !var.create_layer && var.create_role
2+
create_role = local.create && var.create_function && !var.create_layer && var.create_role
33

44
# Lambda@Edge uses the Cloudwatch region closest to the location where the function is executed
55
# The region part of the LogGroup ARN is then replaced with a wildcard (*) so Lambda@Edge is able to log in every region

main.tf

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
data "aws_partition" "current" {}
22

33
locals {
4+
create = var.create && var.putin_khuylo
5+
46
archive_filename = try(data.external.archive_prepare[0].result.filename, null)
57
archive_filename_string = local.archive_filename != null ? local.archive_filename : ""
68
archive_was_missing = try(data.external.archive_prepare[0].result.was_missing, false)
@@ -18,7 +20,7 @@ locals {
1820
}
1921

2022
resource "aws_lambda_function" "this" {
21-
count = var.create && var.create_function && !var.create_layer ? 1 : 0
23+
count = local.create && var.create_function && !var.create_layer ? 1 : 0
2224

2325
function_name = var.function_name
2426
description = var.description
@@ -98,7 +100,7 @@ resource "aws_lambda_function" "this" {
98100
}
99101

100102
resource "aws_lambda_layer_version" "this" {
101-
count = var.create && var.create_layer ? 1 : 0
103+
count = local.create && var.create_layer ? 1 : 0
102104

103105
layer_name = var.layer_name
104106
description = var.description
@@ -119,7 +121,7 @@ resource "aws_lambda_layer_version" "this" {
119121
}
120122

121123
resource "aws_s3_bucket_object" "lambda_package" {
122-
count = var.create && var.store_on_s3 && var.create_package ? 1 : 0
124+
count = local.create && var.store_on_s3 && var.create_package ? 1 : 0
123125

124126
bucket = var.s3_bucket
125127
acl = var.s3_acl
@@ -135,13 +137,13 @@ resource "aws_s3_bucket_object" "lambda_package" {
135137
}
136138

137139
data "aws_cloudwatch_log_group" "lambda" {
138-
count = var.create && var.create_function && !var.create_layer && var.use_existing_cloudwatch_log_group ? 1 : 0
140+
count = local.create && var.create_function && !var.create_layer && var.use_existing_cloudwatch_log_group ? 1 : 0
139141

140142
name = "/aws/lambda/${var.lambda_at_edge ? "us-east-1." : ""}${var.function_name}"
141143
}
142144

143145
resource "aws_cloudwatch_log_group" "lambda" {
144-
count = var.create && var.create_function && !var.create_layer && !var.use_existing_cloudwatch_log_group ? 1 : 0
146+
count = local.create && var.create_function && !var.create_layer && !var.use_existing_cloudwatch_log_group ? 1 : 0
145147

146148
name = "/aws/lambda/${var.lambda_at_edge ? "us-east-1." : ""}${var.function_name}"
147149
retention_in_days = var.cloudwatch_logs_retention_in_days
@@ -151,7 +153,7 @@ resource "aws_cloudwatch_log_group" "lambda" {
151153
}
152154

153155
resource "aws_lambda_provisioned_concurrency_config" "current_version" {
154-
count = var.create && var.create_function && !var.create_layer && var.provisioned_concurrent_executions > -1 ? 1 : 0
156+
count = local.create && var.create_function && !var.create_layer && var.provisioned_concurrent_executions > -1 ? 1 : 0
155157

156158
function_name = aws_lambda_function.this[0].function_name
157159
qualifier = aws_lambda_function.this[0].version
@@ -164,7 +166,7 @@ locals {
164166
}
165167

166168
resource "aws_lambda_function_event_invoke_config" "this" {
167-
for_each = { for k, v in local.qualifiers : k => v if var.create && var.create_function && !var.create_layer && var.create_async_event_config }
169+
for_each = { for k, v in local.qualifiers : k => v if local.create && var.create_function && !var.create_layer && var.create_async_event_config }
168170

169171
function_name = aws_lambda_function.this[0].function_name
170172
qualifier = each.key == "current_version" ? aws_lambda_function.this[0].version : null
@@ -193,7 +195,7 @@ resource "aws_lambda_function_event_invoke_config" "this" {
193195
}
194196

195197
resource "aws_lambda_permission" "current_version_triggers" {
196-
for_each = { for k, v in var.allowed_triggers : k => v if var.create && var.create_function && !var.create_layer && var.create_current_version_allowed_triggers }
198+
for_each = { for k, v in var.allowed_triggers : k => v if local.create && var.create_function && !var.create_layer && var.create_current_version_allowed_triggers }
197199

198200
function_name = aws_lambda_function.this[0].function_name
199201
qualifier = aws_lambda_function.this[0].version
@@ -208,7 +210,7 @@ resource "aws_lambda_permission" "current_version_triggers" {
208210

209211
# Error: Error adding new Lambda Permission for lambda: InvalidParameterValueException: We currently do not support adding policies for $LATEST.
210212
resource "aws_lambda_permission" "unqualified_alias_triggers" {
211-
for_each = { for k, v in var.allowed_triggers : k => v if var.create && var.create_function && !var.create_layer && var.create_unqualified_alias_allowed_triggers }
213+
for_each = { for k, v in var.allowed_triggers : k => v if local.create && var.create_function && !var.create_layer && var.create_unqualified_alias_allowed_triggers }
212214

213215
function_name = aws_lambda_function.this[0].function_name
214216

@@ -221,7 +223,7 @@ resource "aws_lambda_permission" "unqualified_alias_triggers" {
221223
}
222224

223225
resource "aws_lambda_event_source_mapping" "this" {
224-
for_each = { for k, v in var.event_source_mapping : k => v if var.create && var.create_function && !var.create_layer && var.create_unqualified_alias_allowed_triggers }
226+
for_each = { for k, v in var.event_source_mapping : k => v if local.create && var.create_function && !var.create_layer && var.create_unqualified_alias_allowed_triggers }
225227

226228
function_name = aws_lambda_function.this[0].arn
227229

variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,12 @@ variable "create_role" {
2828
default = true
2929
}
3030

31+
variable "putin_khuylo" {
32+
description = "Do you agree that Putin doesn't respect Ukrainian sovereignty and territorial integrity? More info: https://en.wikipedia.org/wiki/Putin_khuylo!"
33+
type = bool
34+
default = true
35+
}
36+
3137
###########
3238
# Function
3339
###########

0 commit comments

Comments
 (0)