2
2
3
3
// Associate an elastic IP to the instance.
4
4
5
- // Some resources are named as "bastion2" because when we updated from ubuntu 20 to ubuntu 24
6
- // we created a new instance (bastion2) and kept the old one (bastion) around for a while.
7
- // When you migrate to a new bastion instance (e.g. to update to ubuntu 26),
8
- // you can name the new resources as "bastion" (instead of "bastion3"), to go back to the original name.
9
-
10
- resource "aws_eip" "bastion2" {
5
+ resource "aws_eip" "bastion" {
11
6
domain = " vpc"
12
7
tags = {
13
- Name = " bastion2 "
8
+ Name = " bastion "
14
9
}
15
10
}
16
11
17
- resource "aws_network_interface" "bastion2 " {
12
+ resource "aws_network_interface" "bastion " {
18
13
subnet_id = data. terraform_remote_state . shared . outputs . prod_vpc . public_subnets [0 ]
19
14
security_groups = [aws_security_group . bastion . id ]
20
15
}
21
16
22
- resource "aws_eip_association" "bastion2 " {
23
- network_interface_id = aws_network_interface. bastion2 . id
24
- allocation_id = aws_eip. bastion2 . id
17
+ resource "aws_eip_association" "bastion " {
18
+ network_interface_id = aws_network_interface. bastion . id
19
+ allocation_id = aws_eip. bastion . id
25
20
}
26
21
27
22
// Create the bastion.infra.rust-lang.org DNS record.
@@ -30,11 +25,11 @@ data "aws_route53_zone" "rust_lang_org" {
30
25
name = " rust-lang.org"
31
26
}
32
27
33
- resource "aws_route53_record" "bastion2 " {
28
+ resource "aws_route53_record" "bastion " {
34
29
zone_id = data. aws_route53_zone . rust_lang_org . id
35
30
name = " bastion.infra.rust-lang.org"
36
31
type = " A"
37
- records = [aws_eip . bastion2 . public_ip ]
32
+ records = [aws_eip . bastion . public_ip ]
38
33
ttl = 300
39
34
}
40
35
@@ -55,7 +50,7 @@ data "aws_ami" "ubuntu24" {
55
50
}
56
51
}
57
52
58
- resource "aws_instance" "bastion2 " {
53
+ resource "aws_instance" "bastion " {
59
54
ami = data. aws_ami . ubuntu24 . id
60
55
instance_type = " t3a.micro"
61
56
key_name = data. terraform_remote_state . shared . outputs . master_ec2_key_pair
@@ -70,12 +65,12 @@ resource "aws_instance" "bastion2" {
70
65
}
71
66
72
67
network_interface {
73
- network_interface_id = aws_network_interface. bastion2 . id
68
+ network_interface_id = aws_network_interface. bastion . id
74
69
device_index = 0
75
70
}
76
71
77
72
tags = {
78
- Name = " bastion2 "
73
+ Name = " bastion "
79
74
Service = " bastion"
80
75
}
81
76
0 commit comments