@@ -5,6 +5,13 @@ resource "aws_eip" "playground" {
5
5
}
6
6
}
7
7
8
+ resource "aws_eip" "playground2" {
9
+ domain = " vpc"
10
+ tags = {
11
+ Name = " playground2"
12
+ }
13
+ }
14
+
8
15
data "dns_a_record_set" "monitoring" {
9
16
host = " monitoring.infra.rust-lang.org"
10
17
}
@@ -98,15 +105,33 @@ resource "aws_network_interface" "playground" {
98
105
security_groups = [aws_security_group . playground . id ]
99
106
}
100
107
108
+ resource "aws_network_interface" "playground2" {
109
+ subnet_id = data. terraform_remote_state . shared . outputs . prod_vpc . public_subnets [0 ]
110
+ security_groups = [aws_security_group . playground . id ]
111
+ }
112
+
101
113
resource "aws_eip_association" "playground" {
102
114
network_interface_id = aws_network_interface. playground . id
103
115
allocation_id = aws_eip. playground . id
104
116
}
105
117
118
+ resource "aws_eip_association" "playground2" {
119
+ network_interface_id = aws_network_interface. playground2 . id
120
+ allocation_id = aws_eip. playground2 . id
121
+ }
122
+
106
123
data "aws_route53_zone" "rust_lang_org" {
107
124
name = " rust-lang.org"
108
125
}
109
126
127
+ resource "aws_route53_record" "playground2" {
128
+ zone_id = data. aws_route53_zone . rust_lang_org . id
129
+ name = " play-2.infra.rust-lang.org"
130
+ type = " A"
131
+ records = [aws_eip . playground2 . public_ip ]
132
+ ttl = 60
133
+ }
134
+
110
135
resource "aws_route53_record" "playground" {
111
136
zone_id = data. aws_route53_zone . rust_lang_org . id
112
137
name = " play-1.infra.rust-lang.org"
@@ -170,6 +195,21 @@ data "aws_ami" "ubuntu" {
170
195
}
171
196
}
172
197
198
+ data "aws_ami" "ubuntu24" {
199
+ most_recent = true
200
+ owners = [" 099720109477" ] # Canonical
201
+
202
+ filter {
203
+ name = " name"
204
+ values = [" ubuntu/images/hvm-ssd-gp3/ubuntu-noble-24.04-amd64-server-*" ]
205
+ }
206
+
207
+ filter {
208
+ name = " virtualization-type"
209
+ values = [" hvm" ]
210
+ }
211
+ }
212
+
173
213
resource "aws_iam_instance_profile" "playground" {
174
214
name = " playground"
175
215
role = aws_iam_role. playground . name
@@ -205,6 +245,36 @@ resource "aws_instance" "playground" {
205
245
}
206
246
}
207
247
248
+ resource "aws_instance" "playground2" {
249
+ ami = data. aws_ami . ubuntu24 . id
250
+ instance_type = " c5a.large"
251
+ key_name = data. terraform_remote_state . shared . outputs . master_ec2_key_pair
252
+ iam_instance_profile = aws_iam_instance_profile. playground . name
253
+ ebs_optimized = true
254
+ disable_api_termination = true
255
+ monitoring = false
256
+
257
+ root_block_device {
258
+ volume_type = " gp3"
259
+ volume_size = 100
260
+ delete_on_termination = true
261
+ }
262
+
263
+ network_interface {
264
+ network_interface_id = aws_network_interface. playground2 . id
265
+ device_index = 0
266
+ }
267
+
268
+ tags = {
269
+ Name = " play-2"
270
+ }
271
+
272
+ lifecycle {
273
+ # Don't recreate the instance automatically when the AMI changes.
274
+ ignore_changes = [ami ]
275
+ }
276
+ }
277
+
208
278
resource "aws_cloudwatch_metric_alarm" "reboot" {
209
279
alarm_name = " playground-status-check"
210
280
alarm_description = " Alarms when playground instance is down"
0 commit comments