no-aurora-pinned-minor-with-auto-upgrade
Warn when an Aurora PostgreSQL cluster pins engine_version more precisely than the auto minor upgrade enabled across its instances will hold stable.
Why
This is the cross-resource companion to no-pinned-minor-with-auto-upgrade. Aurora splits the two operands across two blocks, so a single-block rule cannot see both halves:
engine_versionis a cluster-level control onaws_rds_cluster. It is inert onaws_rds_cluster_instance: per the provider docs, an engine upgrade "must be done on theaws_rds_clusterengine_version. Trying to upgrade inaws_cluster_instancewill not update theengine_version".auto_minor_version_upgradeis only onaws_rds_cluster_instance;aws_rds_clusterhas no such argument.
The rule pairs each aws_rds_cluster with the aws_rds_cluster_instance blocks that reference it through cluster_identifier, then checks the cluster's engine_version against auto upgrade across those instances. Instances in sibling files of the same module are included.
Auto upgrade only fires cluster-wide when every instance opts in: AWS notes that "if any DB instance in your cluster has this setting turned off, the DB cluster isn't automatically upgraded". So the rule treats auto upgrade as on only when the AND across all instances is true, where an absent auto_minor_version_upgrade defaults to true.
What it flags
resource "aws_rds_cluster" "c" {
engine = "aurora-postgresql"
engine_version = "15.4" # pins the minor
}
resource "aws_rds_cluster_instance" "ci" {
cluster_identifier = aws_rds_cluster.c.id
# auto_minor_version_upgrade omitted, which defaults to true
}The warning is emitted on the cluster's engine_version attribute and names the drift-safe form to use ("15" here). AWS resolves a bare major to the current default minor and floats it under auto upgrade, so "15" produces no plan diff against a live 15.x.
What it leaves alone
- A cluster where any matching instance sets
auto_minor_version_upgrade = false: auto upgrade won't fire, so the pin is safe. - A cluster with no matching instances: auto upgrade can't be established, so there is nothing to flag.
engine = "aurora-mysql": version strings like"8.0.mysql_aurora.3.04.0"have no clean numeric prefix, so no shorter form can be recommended.- Dynamic
engine_version, and acluster_identifierwritten as a literal string. Only theaws_rds_cluster.<name>traversal form is matched.