-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathaws_ecs_service_bitcoin.tf
47 lines (38 loc) · 1.49 KB
/
aws_ecs_service_bitcoin.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
# ------------------------------------------------------------------------------
# ECS Service (bitcoin-core)
# ------------------------------------------------------------------------------
resource "aws_ecs_service" "bitcoin" {
name = local.bitcoin_service_name
cluster = aws_ecs_cluster.this.id
task_definition = aws_ecs_task_definition.bitcoin.arn
launch_type = "EC2"
desired_count = var.bitcoin_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_btc_19001_id # bitcoin rpc
]
assign_public_ip = false
}
tags = local.tags
}
# ------------------------------------------------------------------------------
# Task Definition
# ------------------------------------------------------------------------------
resource "aws_ecs_task_definition" "bitcoin" {
family = local.bitcoin_service_name
requires_compatibilities = ["EC2"]
network_mode = "awsvpc"
execution_role_arn = aws_iam_role.ecsTaskExecutionRole.arn
memory = var.bitcoin_container_memory_alloc
cpu = var.bitcoin_container_cpu_alloc
tags = local.tags
volume {
name = var.bitcoin_ebs_volume_name
host_path = var.bitcoin_data_path
}
container_definitions = format("[%s]", join(",", [
"${local.bitcoin_def}"
]))
}