fix(bug): INFRA-1007 Use mysql major version in var, only - #359
Conversation
## Walkthrough
The changes update the default values of two variables related to database engine versions in Terraform configuration files. Both variables now use the generic version "8.0" instead of previously specified Aurora MySQL version strings. The description of one variable was clarified to indicate it expects only the major version. No other modifications were made to variable types or attributes.
## Changes
| File(s) | Change Summary |
|----------------------------------|------------------------------------------------------------------------------------------------|
| modules/database/variables.tf | Updated description for `engine_version` to specify major version only; changed default from `"8.0.mysql_aurora.3.05.2"` to `"8.0"` |
| variables.tf | Changed default for `database_engine_version` from `"8.0.mysql_aurora.3.07.1"` to `"8.0"` |
## Estimated code review effort
1 (~2 minutes)
## Poem
> A hop, a skip, a version tweak,
> Aurora specifics no longer we seek.
> "8.0" is now the chosen tune,
> Making our configs simple and immune.
> With every change, a carrot earned—
> For tidy code, this bunny's learned! 🥕📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 1
🔭 Outside diff range comments (1)
modules/database/variables.tf (1)
27-31: Type mismatch:create_db_subnet_groupisstringbut default istrue
Terraform will error becausetrueis not a string.-variable "create_db_subnet_group" { - description = "Determines whether to create the databae subnet group or use existing" - type = string - default = true -} +variable "create_db_subnet_group" { + description = "Whether to create the database subnet group (true) or use an existing one (false)" + type = bool + default = true +}
♻️ Duplicate comments (1)
variables.tf (1)
56-60: Same concern:"8.0"may not pass provider validation
For consistency and to avoid deployment failures, keep the fully-qualified Aurora version or default tonull.
🧹 Nitpick comments (2)
modules/database/variables.tf (1)
21-23: Minor: spelling / clarity
"Version for MySQL Auora to use" → "Version of Aurora MySQL to use".variables.tf (1)
56-58: Clarify description
Consider stating “Aurora MySQL engine version (e.g.8.0.mysql_aurora.3.x.x)” so callers know the expected format.
| variable "engine_version" { | ||
| description = "Version for MySQL Auora to use" | ||
| type = string | ||
| default = "8.0.mysql_aurora.3.05.2" | ||
| default = "8.0" | ||
| } |
There was a problem hiding this comment.
💡 Verification agent
🧩 Analysis chain
Default "8.0" is very likely invalid for Aurora-MySQL
Aurora requires the full engine patch string (e.g. 8.0.mysql_aurora.3.05.2). Supplying only the major ("8.0") makes aws_rds_cluster fail with
InvalidParameterValue: 1 validation error detected: Value '8.0' at 'engineVersion'
- Keep the previous explicit version or set the default to
nulland let callers decide. - At minimum, add a note in the description that a full patch version is expected.
#!/bin/bash
set -e
echo "=== variables.tf snippet (first 50 lines) ==="
sed -n '1,50p' modules/database/variables.tf || true
echo -e "\n=== occurrences of 'engine_version' in modules ==="
rg -n "engine_version" -n modules || true
echo -e "\n=== occurrences of aws_rds_cluster in modules ==="
rg -n "aws_rds_cluster" -n modules || true🌐 Web query:
Does Terraform’s aws_rds_cluster engine_version parameter accept short versions like "8.0" for Aurora MySQL, or must it be the full engine version string such as "8.0.mysql_aurora.3.05.2"?
💡 Result:
In Terraform, when configuring an aws_rds_cluster resource for Aurora MySQL, the engine_version parameter requires the full engine version string, such as "5.7.mysql_aurora.2.07.6". Short versions like "5.7" are not accepted. This is because AWS RDS uses a specific versioning scheme for Aurora MySQL, which includes the major version, the .mysql_aurora identifier, and the Aurora-specific version number. (provose.com)
For example, to specify Aurora MySQL version 5.7 with Aurora version 2.07.6, you would set:
resource "aws_rds_cluster" "example" {
engine = "aurora-mysql"
engine_version = "5.7.mysql_aurora.2.07.6"
# ... other parameters ...
}Using a short version like "5.7" will result in an error, as Terraform expects the full version string. This requirement aligns with AWS's versioning format for Aurora MySQL. (provose.com)
Therefore, always specify the complete engine version when configuring Aurora MySQL clusters in Terraform.
Citations:
- 1: https://provose.com/v2.0/reference/mysql_clusters/?utm_source=openai
- 2: https://provose.com/v2.0/reference/mysql_clusters/?utm_source=openai
Default engine_version must include the full Aurora MySQL patch string
Aurora-MySQL’s engine_version parameter does not accept just “8.0” and will fail with:
InvalidParameterValue: 1 validation error detected: Value '8.0' at 'engineVersion'
You should either:
- Provide a known full version as the default (e.g.
"8.0.mysql_aurora.3.05.2"), or - Set
default = nulland require callers to specify the full version.
Also update the variable’s description to call out that a full patch‐level version is required.
Locations to update:
- modules/database/variables.tf (lines 21–25)
Suggested diff:
variable "engine_version" {
- description = "Version for MySQL Auora to use"
+ description = "Aurora MySQL full engine version (e.g. 8.0.mysql_aurora.3.05.2)"
type = string
- default = "8.0"
+ default = null # callers must supply full version, e.g. 8.0.mysql_aurora.3.05.2
}📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| variable "engine_version" { | |
| description = "Version for MySQL Auora to use" | |
| type = string | |
| default = "8.0.mysql_aurora.3.05.2" | |
| default = "8.0" | |
| } | |
| variable "engine_version" { | |
| description = "Aurora MySQL full engine version (e.g. 8.0.mysql_aurora.3.05.2)" | |
| type = string | |
| default = null # callers must supply full version, e.g. 8.0.mysql_aurora.3.05.2 | |
| } |
🤖 Prompt for AI Agents
In modules/database/variables.tf lines 21 to 25, update the variable
"engine_version" to require a full Aurora MySQL patch-level version string
instead of just "8.0". Change the default value to a complete version string
like "8.0.mysql_aurora.3.05.2" or set the default to null to force callers to
specify it. Also, revise the description to clearly state that a full
patch-level version is required for the engine_version variable.
### [7.14.4](v7.14.3...v7.14.4) (2025-07-22) ### Bug Fixes * **bug:** INFRA-1007 Use mysql major version in var, only ([#359](#359)) ([44ca372](44ca372))
|
This PR is included in version 7.14.4 🎉 |
Summary by CodeRabbit