Skip to content

docs(terraform): use variable for DB version and instance class#2466

Open
queria wants to merge 1 commit into
guacsec:mainfrom
queria:tf-db-version-class
Open

docs(terraform): use variable for DB version and instance class#2466
queria wants to merge 1 commit into
guacsec:mainfrom
queria:tf-db-version-class

Conversation

@queria

@queria queria commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

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:

  • Add Terraform variables for database engine version and RDS instance class in the admin example configuration.

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.
@sourcery-ai

sourcery-ai Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Makes 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 configuration

flowchart 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"]
Loading

File-Level Changes

Change Details Files
Introduce Terraform variables for RDS engine version and instance class and wire aws_db_instance to use them.
  • Add db-engine-version variable with default PostgreSQL version and description.
  • Add db-instance-class variable with default instance class and description.
  • Update aws_db_instance.trustify to reference the new variables instead of hard-coded engine_version and instance_class values.
docs/book/modules/admin/examples/trustify/database.tf

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've found 1 issue, and left some high level feedback:

  • 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.
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>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment on lines +53 to +62
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)"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

codecov Bot commented Jul 9, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 71.65%. Comparing base (d511ac8) to head (3f26b68).

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

1 participant