Skip to content

Commit

Permalink
subnet is now optionnal
Browse files Browse the repository at this point in the history
  • Loading branch information
leiicamundi committed Sep 12, 2024
1 parent 0f7dba7 commit 67fd689
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions modules/aurora/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ resource "aws_rds_cluster" "aurora_cluster" {
iam_roles = var.iam_roles # only needed if wanted to grant access from Aurora to e.g. S3

vpc_security_group_ids = [aws_security_group.this.id]
db_subnet_group_name = aws_db_subnet_group.this.name
db_subnet_group_name = aws_db_subnet_group.this[0].name
skip_final_snapshot = true
apply_immediately = true
storage_encrypted = true
Expand Down Expand Up @@ -50,7 +50,7 @@ resource "aws_rds_cluster_instance" "aurora_instance" {
auto_minor_version_upgrade = var.auto_minor_version_upgrade
instance_class = var.instance_class

db_subnet_group_name = aws_db_subnet_group.this.name
db_subnet_group_name = aws_db_subnet_group.this[0].name

apply_immediately = true

Expand Down Expand Up @@ -104,6 +104,8 @@ resource "aws_security_group_rule" "allow_ingress" {
resource "aws_db_subnet_group" "this" {
name = var.cluster_name

count = length(var.subnet_ids) > 0 ? 1 : 0

description = "For Aurora cluster ${var.cluster_name}"
subnet_ids = var.subnet_ids

Expand Down

0 comments on commit 67fd689

Please sign in to comment.