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