-
Notifications
You must be signed in to change notification settings - Fork 0
/
instances.tf
71 lines (54 loc) · 1.66 KB
/
instances.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
data "aws_ami" "ubuntu" {
most_recent = true
filter {
name = "name"
values = ["ubuntu/images/hvm-ssd/ubuntu-jammy-22.04-amd64-server-*"]
}
filter {
name = "virtualization-type"
values = ["hvm"]
}
owners = ["099720109477"] # Canonical
}
resource "aws_instance" "runner" {
ami = data.aws_ami.ubuntu.id
instance_type = "t3.medium"
subnet_id = aws_subnet.private.id
key_name = var.key_pair
iam_instance_profile = aws_iam_instance_profile.instance_profile.name
instance_market_options {
market_type = "spot"
spot_options {
max_price = 0.06
}
}
user_data = templatefile("gitlab-runner-userdata.sh.tpl", { gitlab_token = var.gitlab_token })
user_data_replace_on_change = true
vpc_security_group_ids = [aws_security_group.runner.id]
associate_public_ip_address = false
private_ip = "10.0.0.250"
tags = {
Name = "Gitlab Runner"
}
}
resource "aws_instance" "dagger" {
ami = data.aws_ami.ubuntu.id
instance_type = "t3.medium"
subnet_id = aws_subnet.private.id
key_name = var.key_pair
iam_instance_profile = aws_iam_instance_profile.instance_profile.name
instance_market_options {
market_type = "spot"
spot_options {
max_price = 0.06
}
}
user_data = templatefile("dagger-instance-userdata.sh.tpl", { dagger_engine_port = var.dagger_engine_port })
user_data_replace_on_change = true
vpc_security_group_ids = [aws_security_group.dagger.id]
associate_public_ip_address = false
private_ip = "10.0.0.251"
tags = {
Name = "Dagger Host"
}
}