From daabd83df5a6758e787ab352fc743bb37f238a9f Mon Sep 17 00:00:00 2001 From: CloudNinjaDev Date: Mon, 2 Mar 2026 18:37:38 +0530 Subject: [PATCH] Update MongoDB instance configuration: enable deletion on termination and update repository URL for RHEL 9 compatibility --- terraform/modules/ec2/main.tf | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/terraform/modules/ec2/main.tf b/terraform/modules/ec2/main.tf index af72cef..744a75a 100644 --- a/terraform/modules/ec2/main.tf +++ b/terraform/modules/ec2/main.tf @@ -50,7 +50,7 @@ resource "aws_instance" "mongodb" { volume_size = var.mongodb_data_volume_size volume_type = "gp3" encrypted = true - delete_on_termination = false + delete_on_termination = true } user_data = <<-EOF @@ -102,11 +102,11 @@ resource "aws_instance" "mongodb" { # Set ownership to mongodb user (will be created during installation) echo "MongoDB data volume mounted at /data/mongodb" - # Add MongoDB repository (using Amazon Linux 2 repo which is compatible) + # Add MongoDB repository (using RHEL 9 repo for Amazon Linux 2023 compatibility) cat > /etc/yum.repos.d/mongodb-org-7.0.repo <<'REPO' [mongodb-org-7.0] name=MongoDB Repository -baseurl=https://repo.mongodb.org/yum/amazon/2/mongodb-org/7.0/x86_64/ +baseurl=https://repo.mongodb.org/yum/redhat/9/mongodb-org/7.0/x86_64/ gpgcheck=1 enabled=1 gpgkey=https://pgp.mongodb.com/server-7.0.asc