-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathaws_ecs_service_electrs.tf
52 lines (42 loc) · 1.58 KB
/
aws_ecs_service_electrs.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# ------------------------------------------------------------------------------
# ECS Service (electrs)
# ------------------------------------------------------------------------------
resource "aws_ecs_service" "electrs" {
name = local.electrs_service_name
cluster = aws_ecs_cluster.this.id
task_definition = aws_ecs_task_definition.electrs.arn
launch_type = "EC2"
desired_count = var.electrs_instance_count
network_configuration {
subnets = [data.terraform_remote_state.vpc.outputs.private_subnets[0]] # us-east-1a (NAT Gateway is here)
security_groups = [
data.terraform_remote_state.vpc.outputs.sg_http_80_id, # port 80
data.terraform_remote_state.vpc.outputs.sg_http_3000_id # electrs rpc
]
assign_public_ip = false
}
tags = local.tags
}
# ------------------------------------------------------------------------------
# Task Definition
# ------------------------------------------------------------------------------
resource "aws_ecs_task_definition" "electrs" {
family = local.electrs_service_name
requires_compatibilities = ["EC2"]
network_mode = "awsvpc"
execution_role_arn = aws_iam_role.ecsTaskExecutionRole.arn
memory = var.electrs_container_memory_alloc
cpu = var.electrs_container_cpu_alloc
tags = local.tags
volume {
name = var.bitcoin_ebs_volume_name
host_path = var.bitcoin_data_path
}
volume {
name = var.electrs_ebs_volume_name
host_path = var.electrs_data_path
}
container_definitions = format("[%s]", join(",", [
"${local.electrs_def}"
]))
}