docs(terraform): use variable for DB version and instance class#2466
docs(terraform): use variable for DB version and instance class#2466queria wants to merge 1 commit into
Conversation
Availability of RDS PostgreSQL engine version and instance class selections depends on the AWS Region. Exposing these (engine version and instance class) as variables, makes it easier to tweak the values for user selected region.
Reviewer's guide (collapsed on small PRs)Reviewer's GuideMakes the example RDS PostgreSQL configuration configurable by introducing variables for engine version and instance class, then wiring the aws_db_instance resource to use them with sensible defaults. Flow diagram for Terraform variables to aws_db_instance configurationflowchart LR
subgraph Variables
db_engine_version["variable db-engine-version\n(default: 17.2)"]
db_instance_class["variable db-instance-class\n(default: db.m7g.large)"]
end
db_engine_version --> engine_version_field["aws_db_instance.trustify\nengine_version = var.db-engine-version"]
db_instance_class --> instance_class_field["aws_db_instance.trustify\ninstance_class = var.db-instance-class"]
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've found 1 issue, and left some high level feedback:
- The variable names using hyphens (
db-engine-version,db-instance-class) will causevar.db-engine-version/var.db-instance-classto be parsed as subtraction in HCL; switch to underscore-based names (e.g.,db_engine_version) and update usages accordingly.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The variable names using hyphens (`db-engine-version`, `db-instance-class`) will cause `var.db-engine-version` / `var.db-instance-class` to be parsed as subtraction in HCL; switch to underscore-based names (e.g., `db_engine_version`) and update usages accordingly.
## Individual Comments
### Comment 1
<location path="docs/book/modules/admin/examples/trustify/database.tf" line_range="53-62" />
<code_context>
description = "Username of the trustify user of the database"
}
+variable "db-engine-version" {
+ type = string
+ default = "17.2"
</code_context>
<issue_to_address>
**issue (bug_risk):** Hyphenated variable names will be interpreted as subtraction when referenced with `var.db-engine-version` / `var.db-instance-class`
In HCL this will be parsed as `var.db - engine - version`, so any `var.db-engine-version` references will fail at plan/apply. For hyphenated variable names, use index syntax (`var["db-engine-version"]`, `var["db-instance-class"]`), or rename to use underscores so you can reference them as `var.db_engine_version` etc.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
| variable "db-engine-version" { | ||
| type = string | ||
| default = "17.2" | ||
| description = "PostgreSQL version" | ||
| } | ||
|
|
||
| variable "db-instance-class" { | ||
| type = string | ||
| default = "db.m7g.large" | ||
| description = "RDS Instance class (defines cpu/mem/network resources available)" |
There was a problem hiding this comment.
issue (bug_risk): Hyphenated variable names will be interpreted as subtraction when referenced with var.db-engine-version / var.db-instance-class
In HCL this will be parsed as var.db - engine - version, so any var.db-engine-version references will fail at plan/apply. For hyphenated variable names, use index syntax (var["db-engine-version"], var["db-instance-class"]), or rename to use underscores so you can reference them as var.db_engine_version etc.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2466 +/- ##
==========================================
+ Coverage 71.64% 71.65% +0.01%
==========================================
Files 453 453
Lines 27497 27497
Branches 27497 27497
==========================================
+ Hits 19700 19703 +3
+ Misses 6669 6659 -10
- Partials 1128 1135 +7 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Availability of RDS PostgreSQL engine version and instance class selections depends on the AWS Region.
Exposing these as variables, makes it easier to tweak the values for user selected region.
Summary by Sourcery
New Features: