This repository has been archived by the owner on Sep 13, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
environment.tf
92 lines (71 loc) · 1.71 KB
/
environment.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
data "aws_ami" "ecs" {
most_recent = true
filter {
name = "name"
values = ["amzn2-ami-ecs-hvm-2.0.*"]
}
filter {
name = "virtualization-type"
values = ["hvm"]
}
owners = ["897127263736"]
}
resource "aws_launch_template" "compute_template" {
name = "test-ce-01"
block_device_mappings {
device_name = "/dev/xvda"
ebs {
volume_size = 50
encrypted = true
}
}
image_id = data.aws_ami.ecs.id
vpc_security_group_ids = [
aws_security_group.batch.id,
]
tag_specifications {
resource_type = "instance"
tags = {
Name = "test-ce-01"
Function = "Batch"
}
}
user_data = base64encode(templatefile("${path.module}/compute_init", {
node_exporter_version = "1.2.2",
cadvisor_version = "v0.40.0",
node_exporter_service = filebase64("${path.module}/prometheusNode.service")
}))
}
resource "aws_batch_compute_environment" "main" {
compute_environment_name = "test-ce-02"
compute_resources {
instance_role = aws_iam_instance_profile.ecs_instance_role.arn
launch_template {
launch_template_id = aws_launch_template.compute_template.id
}
instance_type = [
"optimal",
]
allocation_strategy = "BEST_FIT"
max_vcpus = 128
min_vcpus = 0
security_group_ids = [
aws_security_group.batch.id,
]
subnets = [aws_subnet.main.id]
type = "EC2"
}
service_role = aws_iam_role.aws_batch_service_role.arn
type = "MANAGED"
}
resource "aws_batch_job_queue" "main" {
depends_on = [
aws_batch_compute_environment.main
]
name = "test-jq-01"
state = "ENABLED"
priority = 1
compute_environments = [
aws_batch_compute_environment.main.arn,
]
}