Skip to content

Commit ba7b55b

Browse files
committed
Added var.maintenance_window and var.auto_upgrade_minor
1 parent a17f818 commit ba7b55b

4 files changed

Lines changed: 30 additions & 4 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# 0.14.0 (Jun 05, 2025)
2+
* Added `var.maintenance_window` to control system updates are applied.
3+
* Added `var.auto_upgrade_minor` to allow disabling of minor version upgrades.
4+
15
# 0.13.9 (May 29, 2025)
26
* Added `db_hostname` and `db_port` outputs.
37

db.tf

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ resource "aws_db_instance" "this" {
1010
engine = "postgres"
1111
engine_version = var.postgres_version
1212
allow_major_version_upgrade = true
13-
auto_minor_version_upgrade = true
13+
auto_minor_version_upgrade = var.auto_upgrade_minor
14+
maintenance_window = var.maintenance_window
1415
instance_class = var.instance_class
1516
multi_az = var.high_availability
1617
allocated_storage = var.allocated_storage

metrics.tf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ locals {
4040

4141
mappings = {
4242
memory_average = {
43-
account_id = local.account_id
44-
expression = "memory_average_bytes / 1048576" // Convert bytes to MB
45-
dimensions = local.dims
43+
account_id = local.account_id
44+
expression = "memory_average_bytes / 1048576" // Convert bytes to MB
45+
dimensions = local.dims
4646
}
4747
memory_average_bytes = {
4848
account_id = local.account_id

variables.tf

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,27 @@ For a list of parameters, see https://docs.aws.amazon.com/AmazonRDS/latest/UserG
8080
EOF
8181
}
8282

83+
variable "auto_upgrade_minor" {
84+
type = bool
85+
default = true
86+
description = <<EOF
87+
Whether or not to automatically upgrade minor versions of the database.
88+
These upgrades are performed during the maintenance window (See `maintenance_window` variable).
89+
EOF
90+
}
91+
92+
variable "maintenance_window" {
93+
type = string
94+
default = "Sat:03:00-Sat:03:30"
95+
description = <<EOF
96+
A weekly time interval in which to performance maintenance (e.g. minor version upgrades, patches, etc.).
97+
This window is configured using UTC time zone.
98+
Syntax: "ddd:hh24:mi-ddd:hh24:mi"
99+
Example: "Mon:00:00-Mon:03:00"
100+
See [RDS Maintenance Window docs](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_UpgradeDBInstance.Maintenance.html#AdjustingTheMaintenanceWindow) for more information.
101+
EOF
102+
}
103+
83104
locals {
84105
port = 5432
85106
}

0 commit comments

Comments
 (0)