Files
threshold/enos/modules/aws_boundary/rds.tf
T
Michael Li 3a7f5d08c5 chore(e2e): Allow AWS to select default db version (#6090)
Rather than hard-coding a version and needing to update this every time it becomes deprecated, we just pick the current default that AWS has set (which should be close to the latest).
2025-09-26 09:26:05 -04:00

46 lines
1.7 KiB
Terraform

# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: BUSL-1.1
resource "aws_db_subnet_group" "boundary" {
name = "boundary-db-subnet-${random_string.cluster_id.result}"
subnet_ids = data.aws_subnets.infra.ids
}
data "aws_rds_engine_version" "default" {
engine = var.db_engine
}
resource "aws_db_instance" "boundary" {
count = var.db_create == true ? 1 : 0
identifier = "boundary-db-${random_string.cluster_id.result}"
allocated_storage = var.db_storage
storage_type = var.db_storage_type
iops = var.db_storage_iops
engine = data.aws_rds_engine_version.default.engine
engine_version = data.aws_rds_engine_version.default.version
instance_class = var.db_class
monitoring_interval = var.db_monitoring_interval
monitoring_role_arn = var.db_monitoring_role_arn
publicly_accessible = false
db_name = local.db_name
network_type = var.ip_version == "4" ? "IPV4" : "DUAL"
// username and password must not be provided when restoring from a snapshot
username = local.is_restored_db ? null : var.db_user
password = local.is_restored_db ? null : var.db_pass
port = var.db_port
skip_final_snapshot = true
db_subnet_group_name = aws_db_subnet_group.boundary.name
vpc_security_group_ids = [aws_security_group.boundary_db_sg.id]
apply_immediately = true
snapshot_identifier = var.db_snapshot_identifier
performance_insights_enabled = true
tags = merge(local.common_tags,
{
Name = "boundary-db-${random_string.cluster_id.result}"
Type = local.boundary_cluster_tag
},
)
}