98 lines
2.1 KiB
HCL
98 lines
2.1 KiB
HCL
resource "aws_efs_file_system" "solr_storage" {
|
|
creation_token = "solr_storage-${var.stage}"
|
|
|
|
tags = {
|
|
Name = "solr_storage_${var.stage}"
|
|
}
|
|
}
|
|
|
|
resource "aws_ecs_task_definition" "solr" {
|
|
family = "solr_${var.stage}"
|
|
container_definitions = file("${var.stage}-solr-taskdef.json")
|
|
memory = 4096
|
|
cpu = 1024
|
|
network_mode = "awsvpc"
|
|
requires_compatibilities = ["FARGATE"]
|
|
execution_role_arn = var.execution_role_arn
|
|
task_role_arn = var.task_role_arn
|
|
|
|
volume {
|
|
name = "solr-storage"
|
|
|
|
efs_volume_configuration {
|
|
file_system_id = aws_efs_file_system.solr_storage.id
|
|
root_directory = "/"
|
|
/*
|
|
authorization_config {
|
|
access_point_id = aws_efs_access_point.test.id
|
|
iam = "ENABLED"
|
|
}
|
|
*/
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
resource "aws_ecs_service" "solr" {
|
|
name = "solr_app_${var.stage}"
|
|
cluster = var.ecs_cluster
|
|
task_definition = aws_ecs_task_definition.solr.arn
|
|
desired_count = 1
|
|
deployment_controller {
|
|
type = "ECS"
|
|
}
|
|
scheduling_strategy = "REPLICA"
|
|
platform_version = "LATEST"
|
|
|
|
network_configuration {
|
|
assign_public_ip = true
|
|
security_groups = [ "sg-004e5855310c453a3", "sg-02d167406b1082698"]
|
|
subnets = [ "subnet-5e675761", "subnet-8519fde2", "subnet-89bab8d4" ]
|
|
}
|
|
|
|
service_registries {
|
|
container_port = 0
|
|
port = 0
|
|
registry_arn = aws_service_discovery_service.solr.arn
|
|
}
|
|
|
|
capacity_provider_strategy {
|
|
base = 1
|
|
capacity_provider = "FARGATE"
|
|
weight = 5
|
|
}
|
|
|
|
deployment_circuit_breaker {
|
|
enable = false
|
|
rollback = false
|
|
}
|
|
|
|
wait_for_steady_state = true
|
|
|
|
|
|
timeouts {}
|
|
lifecycle {
|
|
ignore_changes = [task_definition]
|
|
}
|
|
}
|
|
|
|
resource "aws_service_discovery_service" "solr" {
|
|
name = "solr-${var.stage}"
|
|
|
|
dns_config {
|
|
namespace_id = var.local_namespace
|
|
|
|
dns_records {
|
|
ttl = 10
|
|
type = "A"
|
|
}
|
|
|
|
routing_policy = "MULTIVALUE"
|
|
}
|
|
|
|
health_check_custom_config {
|
|
failure_threshold = 1
|
|
}
|
|
}
|
|
|