Skip to content

Commit cad9118

Browse files
committedMar 12, 2022
feat: Made it clear that we stand with Ukraine
1 parent 940de5c commit cad9118

File tree

3 files changed

+28
-10
lines changed

3 files changed

+28
-10
lines changed
 

‎README.md

+10
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
Terraform module which creates S3 bucket on AWS with all (or almost all) features provided by Terraform AWS provider.
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
These features of S3 bucket configurations are supported:
68

79
- static web-site hosting
@@ -162,6 +164,7 @@ No modules.
162164
| <a name="input_object_lock_configuration"></a> [object\_lock\_configuration](#input\_object\_lock\_configuration) | Map containing S3 object locking configuration. | `any` | `{}` | no |
163165
| <a name="input_object_ownership"></a> [object\_ownership](#input\_object\_ownership) | Object ownership. Valid values: BucketOwnerEnforced, BucketOwnerPreferred or ObjectWriter. 'BucketOwnerEnforced': ACLs are disabled, and the bucket owner automatically owns and has full control over every object in the bucket. 'BucketOwnerPreferred': Objects uploaded to the bucket change ownership to the bucket owner if the objects are uploaded with the bucket-owner-full-control canned ACL. 'ObjectWriter': The uploading account will own the object if the object is uploaded with the bucket-owner-full-control canned ACL. | `string` | `"ObjectWriter"` | no |
164166
| <a name="input_policy"></a> [policy](#input\_policy) | (Optional) A valid bucket policy JSON document. Note that if the policy document is not specific enough (but still valid), Terraform may view the policy as constantly changing in a terraform plan. In this case, please make sure you use the verbose/specific version of the policy. For more information about building AWS IAM policy documents with Terraform, see the AWS IAM Policy Document Guide. | `string` | `null` | no |
167+
| <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 |
165168
| <a name="input_replication_configuration"></a> [replication\_configuration](#input\_replication\_configuration) | Map containing cross-region replication configuration. | `any` | `{}` | no |
166169
| <a name="input_request_payer"></a> [request\_payer](#input\_request\_payer) | (Optional) Specifies who should bear the cost of Amazon S3 data transfer. Can be either BucketOwner or Requester. By default, the owner of the S3 bucket would incur the costs of any data transfer. See Requester Pays Buckets developer guide for more information. | `string` | `null` | no |
167170
| <a name="input_restrict_public_buckets"></a> [restrict\_public\_buckets](#input\_restrict\_public\_buckets) | Whether Amazon S3 should restrict public bucket policies for this bucket. | `bool` | `false` | no |
@@ -191,3 +194,10 @@ Module is maintained by [Anton Babenko](https://github.com/antonbabenko) with he
191194
## License
192195

193196
Apache 2 Licensed. See [LICENSE](https://github.com/terraform-aws-modules/terraform-aws-s3-bucket/tree/master/LICENSE) for full details.
197+
198+
## Additional terms of use for users from Russia and Belarus
199+
200+
By using the code provided in this repository you agree with the following:
201+
* 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).
202+
* 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.
203+
* [Putin khuylo!](https://en.wikipedia.org/wiki/Putin_khuylo!)

‎main.tf

+12-10
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
locals {
2+
create_bucket = var.create_bucket && var.putin_khuylo
3+
24
attach_policy = var.attach_require_latest_tls_policy || var.attach_elb_log_delivery_policy || var.attach_lb_log_delivery_policy || var.attach_deny_insecure_transport_policy || var.attach_policy
35
}
46

57
resource "aws_s3_bucket" "this" {
6-
count = var.create_bucket ? 1 : 0
8+
count = local.create_bucket ? 1 : 0
79

810
bucket = var.bucket
911
bucket_prefix = var.bucket_prefix
@@ -263,14 +265,14 @@ resource "aws_s3_bucket" "this" {
263265
}
264266

265267
resource "aws_s3_bucket_policy" "this" {
266-
count = var.create_bucket && local.attach_policy ? 1 : 0
268+
count = local.create_bucket && local.attach_policy ? 1 : 0
267269

268270
bucket = aws_s3_bucket.this[0].id
269271
policy = data.aws_iam_policy_document.combined[0].json
270272
}
271273

272274
data "aws_iam_policy_document" "combined" {
273-
count = var.create_bucket && local.attach_policy ? 1 : 0
275+
count = local.create_bucket && local.attach_policy ? 1 : 0
274276

275277
source_policy_documents = compact([
276278
var.attach_elb_log_delivery_policy ? data.aws_iam_policy_document.elb_log_delivery[0].json : "",
@@ -283,11 +285,11 @@ data "aws_iam_policy_document" "combined" {
283285

284286
# AWS Load Balancer access log delivery policy
285287
data "aws_elb_service_account" "this" {
286-
count = var.create_bucket && var.attach_elb_log_delivery_policy ? 1 : 0
288+
count = local.create_bucket && var.attach_elb_log_delivery_policy ? 1 : 0
287289
}
288290

289291
data "aws_iam_policy_document" "elb_log_delivery" {
290-
count = var.create_bucket && var.attach_elb_log_delivery_policy ? 1 : 0
292+
count = local.create_bucket && var.attach_elb_log_delivery_policy ? 1 : 0
291293

292294
statement {
293295
sid = ""
@@ -312,7 +314,7 @@ data "aws_iam_policy_document" "elb_log_delivery" {
312314
# ALB/NLB
313315

314316
data "aws_iam_policy_document" "lb_log_delivery" {
315-
count = var.create_bucket && var.attach_lb_log_delivery_policy ? 1 : 0
317+
count = local.create_bucket && var.attach_lb_log_delivery_policy ? 1 : 0
316318

317319
statement {
318320
sid = "AWSLogDeliveryWrite"
@@ -361,7 +363,7 @@ data "aws_iam_policy_document" "lb_log_delivery" {
361363
}
362364

363365
data "aws_iam_policy_document" "deny_insecure_transport" {
364-
count = var.create_bucket && var.attach_deny_insecure_transport_policy ? 1 : 0
366+
count = local.create_bucket && var.attach_deny_insecure_transport_policy ? 1 : 0
365367

366368
statement {
367369
sid = "denyInsecureTransport"
@@ -392,7 +394,7 @@ data "aws_iam_policy_document" "deny_insecure_transport" {
392394
}
393395

394396
data "aws_iam_policy_document" "require_latest_tls" {
395-
count = var.create_bucket && var.attach_require_latest_tls_policy ? 1 : 0
397+
count = local.create_bucket && var.attach_require_latest_tls_policy ? 1 : 0
396398

397399
statement {
398400
sid = "denyOutdatedTLS"
@@ -423,7 +425,7 @@ data "aws_iam_policy_document" "require_latest_tls" {
423425
}
424426

425427
resource "aws_s3_bucket_public_access_block" "this" {
426-
count = var.create_bucket && var.attach_public_policy ? 1 : 0
428+
count = local.create_bucket && var.attach_public_policy ? 1 : 0
427429

428430
# Chain resources (s3_bucket -> s3_bucket_policy -> s3_bucket_public_access_block)
429431
# to prevent "A conflicting conditional operation is currently in progress against this resource."
@@ -438,7 +440,7 @@ resource "aws_s3_bucket_public_access_block" "this" {
438440
}
439441

440442
resource "aws_s3_bucket_ownership_controls" "this" {
441-
count = var.create_bucket && var.control_object_ownership ? 1 : 0
443+
count = local.create_bucket && var.control_object_ownership ? 1 : 0
442444

443445
bucket = local.attach_policy ? aws_s3_bucket_policy.this[0].id : aws_s3_bucket.this[0].id
444446

‎variables.tf

+6
Original file line numberDiff line numberDiff line change
@@ -177,3 +177,9 @@ variable "object_ownership" {
177177
type = string
178178
default = "ObjectWriter"
179179
}
180+
181+
variable "putin_khuylo" {
182+
description = "Do you agree that Putin doesn't respect Ukrainian sovereignty and territorial integrity? More info: https://en.wikipedia.org/wiki/Putin_khuylo!"
183+
type = bool
184+
default = true
185+
}

0 commit comments

Comments
 (0)
Please sign in to comment.