Skip to content

Commit

Permalink
bug/193-enable-http-endpoint (#234)
Browse files Browse the repository at this point in the history
* Add support for serverless v2 and improve HTTP endpoint logic

Introduced a new variable to differentiate between standard serverless and serverless v2 configurations. Updated the logic for enabling HTTP endpoints to account for both serverless and serverless v2 setups.

* Reordered the serverless_v2 condition to be more logical and simplified the enable_http_endpoint condition by removing redundant checks for improved clarity and maintainability.

---------

Co-authored-by: Igor Rodionov <[email protected]>
  • Loading branch information
tsaucier0 and goruha authored Oct 1, 2024
1 parent d3551cb commit 48d4ba3
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ locals {
cluster_instance_count = local.enabled ? var.cluster_size : 0
is_regional_cluster = var.cluster_type == "regional"
is_serverless = var.engine_mode == "serverless"
is_serverless_v2 = var.instance_type == "db.serverless" && (contains(["aurora-postgresql", "aurora-mysql"], var.engine)) && var.engine_mode == "provisioned"
enable_http_endpoint = var.enable_http_endpoint && (local.is_serverless || local.is_serverless_v2)
ignore_admin_credentials = var.replication_source_identifier != "" || var.snapshot_identifier != null
reserved_instance_engine = split("-", var.engine)[1]
use_reserved_instances = var.use_reserved_instances && !local.is_serverless && contains(["mysql", "postgresql"], local.reserved_instance_engine)
Expand Down Expand Up @@ -151,7 +153,7 @@ resource "aws_rds_cluster" "primary" {
engine_mode = var.engine_mode
iam_roles = var.iam_roles
backtrack_window = var.backtrack_window
enable_http_endpoint = local.is_serverless && var.enable_http_endpoint
enable_http_endpoint = local.enable_http_endpoint
port = var.db_port
enable_global_write_forwarding = var.enable_global_write_forwarding

Expand Down Expand Up @@ -251,7 +253,7 @@ resource "aws_rds_cluster" "secondary" {
engine_mode = var.engine_mode
iam_roles = var.iam_roles
backtrack_window = var.backtrack_window
enable_http_endpoint = local.is_serverless && var.enable_http_endpoint
enable_http_endpoint = local.enable_http_endpoint
port = var.db_port

depends_on = [
Expand Down

0 comments on commit 48d4ba3

Please sign in to comment.