This commit is contained in:
2026-04-26 21:30:27 -07:00
parent 79224fbf13
commit 108cc204a9
14 changed files with 4581 additions and 1305 deletions

View File

@@ -1,4 +1,5 @@
resource "aws_instance" "solr_ec2" {
count = var.enable_solr ? 1 : 0
ami = data.aws_ami.amazon_linux_2023.id
instance_type = "m7g.large"
key_name = "http-proxy"
@@ -34,7 +35,8 @@ filter {
}
resource "aws_ebs_volume" "solr_ec2_storage" {
availability_zone = aws_instance.solr_ec2.availability_zone
count = var.enable_solr ? 1 : 0
availability_zone = aws_instance.solr_ec2[0].availability_zone
size = 30 # Size of the EBS volume in GB.
tags = {
@@ -43,22 +45,24 @@ resource "aws_ebs_volume" "solr_ec2_storage" {
}
resource "aws_volume_attachment" "attach_solr_storage" {
count = var.enable_solr ? 1 : 0
device_name = "/dev/xvdf" # Choose a suitable device name based on your needs.
instance_id = aws_instance.solr_ec2.id
volume_id = aws_ebs_volume.solr_ec2_storage.id
instance_id = aws_instance.solr_ec2[0].id
volume_id = aws_ebs_volume.solr_ec2_storage[0].id
#wait_for detachment_timeout = "30m"
#wait for detachment_timeout = "30m"
}
# You may need to add additional resources such as IAM roles, security groups configuration, etc.,
# depending on what services or actions your Solr needs access to.
output "ec2_public_ip" {
value = aws_instance.solr_ec2.public_ip
value = var.enable_solr ? aws_instance.solr_ec2[0].public_ip : ""
}
resource "aws_service_discovery_service" "solr_ec2" {
count = var.enable_solr ? 1 : 0
name = "solr-ec2-${var.stage}"
dns_config {
@@ -77,11 +81,12 @@ resource "aws_service_discovery_service" "solr_ec2" {
}
resource "aws_service_discovery_instance" "solr_instance" {
service_id = aws_service_discovery_service.solr_ec2.id
count = var.enable_solr ? 1 : 0
service_id = aws_service_discovery_service.solr_ec2[0].id
instance_id = "solr-ec2"
attributes = {
"AWS_INSTANCE_IPV4" = aws_instance.solr_ec2.private_ip
"AWS_INSTANCE_IPV4" = aws_instance.solr_ec2[0].private_ip
}
depends_on = [