Skip to content

Commit 57c20b9

Browse files
committed
feat: Made it clear that we stand with Ukraine
1 parent 8166bb5 commit 57c20b9

File tree

4 files changed

+35
-17
lines changed

4 files changed

+35
-17
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
repos:
22
- repo: https://github.com/antonbabenko/pre-commit-terraform
3-
rev: v1.62.3
3+
rev: v1.64.0
44
hooks:
55
- id: terraform_fmt
66
- id: terraform_validate

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 AWS RDS Aurora resources.
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
## Available Features
68

79
- Autoscaling of read-replicas
@@ -328,6 +330,7 @@ No modules.
328330
| <a name="input_preferred_backup_window"></a> [preferred\_backup\_window](#input\_preferred\_backup\_window) | The daily time range during which automated backups are created if automated backups are enabled using the `backup_retention_period` parameter. Time in UTC | `string` | `"02:00-03:00"` | no |
329331
| <a name="input_preferred_maintenance_window"></a> [preferred\_maintenance\_window](#input\_preferred\_maintenance\_window) | The weekly time range during which system maintenance can occur, in (UTC) | `string` | `"sun:05:00-sun:06:00"` | no |
330332
| <a name="input_publicly_accessible"></a> [publicly\_accessible](#input\_publicly\_accessible) | Determines whether instances are publicly accessible. Default false | `bool` | `null` | no |
333+
| <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 |
331334
| <a name="input_random_password_length"></a> [random\_password\_length](#input\_random\_password\_length) | Length of random password to create. Defaults to `10` | `number` | `10` | no |
332335
| <a name="input_replication_source_identifier"></a> [replication\_source\_identifier](#input\_replication\_source\_identifier) | ARN of a source DB cluster or DB instance if this DB cluster is to be created as a Read Replica | `string` | `null` | no |
333336
| <a name="input_restore_to_point_in_time"></a> [restore\_to\_point\_in\_time](#input\_restore\_to\_point\_in\_time) | Map of nested attributes for cloning Aurora cluster | `map(string)` | `{}` | no |
@@ -378,3 +381,10 @@ Module is maintained by [Anton Babenko](https://github.com/antonbabenko) with he
378381
## License
379382

380383
Apache 2 Licensed. See [LICENSE](https://github.com/terraform-aws-modules/terraform-aws-rds-aurora/tree/master/LICENSE) for full details.
384+
385+
## Additional terms of use for users from Russia and Belarus
386+
387+
By using the code provided in this repository you agree with the following:
388+
* 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).
389+
* 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.
390+
* [Putin khuylo!](https://en.wikipedia.org/wiki/Putin_khuylo!)

main.tf

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
locals {
2+
create_cluster = var.create_cluster && var.putin_khuylo
3+
24
port = coalesce(var.port, (var.engine == "aurora-postgresql" ? 5432 : 3306))
35

46
db_subnet_group_name = var.create_db_subnet_group ? join("", aws_db_subnet_group.this.*.name) : var.db_subnet_group_name
57
internal_db_subnet_group_name = try(coalesce(var.db_subnet_group_name, var.name), "")
6-
master_password = var.create_cluster && var.create_random_password ? random_password.master_password[0].result : var.master_password
8+
master_password = local.create_cluster && var.create_random_password ? random_password.master_password[0].result : var.master_password
79
backtrack_window = (var.engine == "aurora-mysql" || var.engine == "aurora") && var.engine_mode != "serverless" ? var.backtrack_window : 0
810

911
rds_enhanced_monitoring_arn = var.create_monitoring_role ? join("", aws_iam_role.rds_enhanced_monitoring.*.arn) : var.monitoring_role_arn
@@ -16,14 +18,14 @@ data "aws_partition" "current" {}
1618

1719
# Random string to use as master password
1820
resource "random_password" "master_password" {
19-
count = var.create_cluster && var.create_random_password ? 1 : 0
21+
count = local.create_cluster && var.create_random_password ? 1 : 0
2022

2123
length = var.random_password_length
2224
special = false
2325
}
2426

2527
resource "random_id" "snapshot_identifier" {
26-
count = var.create_cluster ? 1 : 0
28+
count = local.create_cluster ? 1 : 0
2729

2830
keepers = {
2931
id = var.name
@@ -33,7 +35,7 @@ resource "random_id" "snapshot_identifier" {
3335
}
3436

3537
resource "aws_db_subnet_group" "this" {
36-
count = var.create_cluster && var.create_db_subnet_group ? 1 : 0
38+
count = local.create_cluster && var.create_db_subnet_group ? 1 : 0
3739

3840
name = local.internal_db_subnet_group_name
3941
description = "For Aurora cluster ${var.name}"
@@ -43,7 +45,7 @@ resource "aws_db_subnet_group" "this" {
4345
}
4446

4547
resource "aws_rds_cluster" "this" {
46-
count = var.create_cluster ? 1 : 0
48+
count = local.create_cluster ? 1 : 0
4749

4850
# Notes:
4951
# iam_roles has been removed from this resource and instead will be used with aws_rds_cluster_role_association below to avoid conflicts per docs
@@ -136,7 +138,7 @@ resource "aws_rds_cluster" "this" {
136138
}
137139

138140
resource "aws_rds_cluster_instance" "this" {
139-
for_each = var.create_cluster && !local.is_serverless ? var.instances : {}
141+
for_each = local.create_cluster && !local.is_serverless ? var.instances : {}
140142

141143
# Notes:
142144
# Do not set preferred_backup_window - its set at the cluster level and will error if provided here
@@ -175,7 +177,7 @@ resource "aws_rds_cluster_instance" "this" {
175177
}
176178

177179
resource "aws_rds_cluster_endpoint" "this" {
178-
for_each = var.create_cluster && !local.is_serverless ? var.endpoints : tomap({})
180+
for_each = local.create_cluster && !local.is_serverless ? var.endpoints : tomap({})
179181

180182
cluster_identifier = try(aws_rds_cluster.this[0].id, "")
181183
cluster_endpoint_identifier = each.value.identifier
@@ -192,7 +194,7 @@ resource "aws_rds_cluster_endpoint" "this" {
192194
}
193195

194196
resource "aws_rds_cluster_role_association" "this" {
195-
for_each = var.create_cluster ? var.iam_roles : {}
197+
for_each = local.create_cluster ? var.iam_roles : {}
196198

197199
db_cluster_identifier = try(aws_rds_cluster.this[0].id, "")
198200
feature_name = each.value.feature_name
@@ -215,7 +217,7 @@ data "aws_iam_policy_document" "monitoring_rds_assume_role" {
215217
}
216218

217219
resource "aws_iam_role" "rds_enhanced_monitoring" {
218-
count = var.create_cluster && var.create_monitoring_role && var.monitoring_interval > 0 ? 1 : 0
220+
count = local.create_cluster && var.create_monitoring_role && var.monitoring_interval > 0 ? 1 : 0
219221

220222
name = var.iam_role_use_name_prefix ? null : var.iam_role_name
221223
name_prefix = var.iam_role_use_name_prefix ? "${var.iam_role_name}-" : null
@@ -232,7 +234,7 @@ resource "aws_iam_role" "rds_enhanced_monitoring" {
232234
}
233235

234236
resource "aws_iam_role_policy_attachment" "rds_enhanced_monitoring" {
235-
count = var.create_cluster && var.create_monitoring_role && var.monitoring_interval > 0 ? 1 : 0
237+
count = local.create_cluster && var.create_monitoring_role && var.monitoring_interval > 0 ? 1 : 0
236238

237239
role = aws_iam_role.rds_enhanced_monitoring[0].name
238240
policy_arn = "arn:${data.aws_partition.current.partition}:iam::aws:policy/service-role/AmazonRDSEnhancedMonitoringRole"
@@ -243,7 +245,7 @@ resource "aws_iam_role_policy_attachment" "rds_enhanced_monitoring" {
243245
################################################################################
244246

245247
resource "aws_appautoscaling_target" "this" {
246-
count = var.create_cluster && var.autoscaling_enabled && !local.is_serverless ? 1 : 0
248+
count = local.create_cluster && var.autoscaling_enabled && !local.is_serverless ? 1 : 0
247249

248250
max_capacity = var.autoscaling_max_capacity
249251
min_capacity = var.autoscaling_min_capacity
@@ -253,7 +255,7 @@ resource "aws_appautoscaling_target" "this" {
253255
}
254256

255257
resource "aws_appautoscaling_policy" "this" {
256-
count = var.create_cluster && var.autoscaling_enabled && !local.is_serverless ? 1 : 0
258+
count = local.create_cluster && var.autoscaling_enabled && !local.is_serverless ? 1 : 0
257259

258260
name = "target-metric"
259261
policy_type = "TargetTrackingScaling"
@@ -282,7 +284,7 @@ resource "aws_appautoscaling_policy" "this" {
282284
################################################################################
283285

284286
resource "aws_security_group" "this" {
285-
count = var.create_cluster && var.create_security_group ? 1 : 0
287+
count = local.create_cluster && var.create_security_group ? 1 : 0
286288

287289
name_prefix = "${var.name}-"
288290
vpc_id = var.vpc_id
@@ -293,7 +295,7 @@ resource "aws_security_group" "this" {
293295

294296
# TODO - change to map of ingress rules under one resource at next breaking change
295297
resource "aws_security_group_rule" "default_ingress" {
296-
count = var.create_cluster && var.create_security_group ? length(var.allowed_security_groups) : 0
298+
count = local.create_cluster && var.create_security_group ? length(var.allowed_security_groups) : 0
297299

298300
description = "From allowed SGs"
299301

@@ -307,7 +309,7 @@ resource "aws_security_group_rule" "default_ingress" {
307309

308310
# TODO - change to map of ingress rules under one resource at next breaking change
309311
resource "aws_security_group_rule" "cidr_ingress" {
310-
count = var.create_cluster && var.create_security_group && length(var.allowed_cidr_blocks) > 0 ? 1 : 0
312+
count = local.create_cluster && var.create_security_group && length(var.allowed_cidr_blocks) > 0 ? 1 : 0
311313

312314
description = "From allowed CIDRs"
313315

@@ -320,7 +322,7 @@ resource "aws_security_group_rule" "cidr_ingress" {
320322
}
321323

322324
resource "aws_security_group_rule" "egress" {
323-
for_each = var.create_cluster && var.create_security_group ? var.security_group_egress_rules : {}
325+
for_each = local.create_cluster && var.create_security_group ? var.security_group_egress_rules : {}
324326

325327
# required
326328
type = "egress"

variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -503,3 +503,9 @@ variable "security_group_egress_rules" {
503503
type = map(any)
504504
default = {}
505505
}
506+
507+
variable "putin_khuylo" {
508+
description = "Do you agree that Putin doesn't respect Ukrainian sovereignty and territorial integrity? More info: https://en.wikipedia.org/wiki/Putin_khuylo!"
509+
type = bool
510+
default = true
511+
}

0 commit comments

Comments
 (0)