Skip to content

Commit

Permalink
Merge pull request #627 from rust-lang/chore-rename-bastion2-to-bastion
Browse files Browse the repository at this point in the history
chore: rename `bastion2` to `bastion`
  • Loading branch information
MarcoIeni authored Oct 28, 2024
2 parents 47be7ce + a5b3dcc commit 46c4fe6
Showing 1 changed file with 11 additions and 16 deletions.
27 changes: 11 additions & 16 deletions terraform/bastion/instance.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,21 @@

// Associate an elastic IP to the instance.

// Some resources are named as "bastion2" because when we updated from ubuntu 20 to ubuntu 24
// we created a new instance (bastion2) and kept the old one (bastion) around for a while.
// When you migrate to a new bastion instance (e.g. to update to ubuntu 26),
// you can name the new resources as "bastion" (instead of "bastion3"), to go back to the original name.

resource "aws_eip" "bastion2" {
resource "aws_eip" "bastion" {
domain = "vpc"
tags = {
Name = "bastion2"
Name = "bastion"
}
}

resource "aws_network_interface" "bastion2" {
resource "aws_network_interface" "bastion" {
subnet_id = data.terraform_remote_state.shared.outputs.prod_vpc.public_subnets[0]
security_groups = [aws_security_group.bastion.id]
}

resource "aws_eip_association" "bastion2" {
network_interface_id = aws_network_interface.bastion2.id
allocation_id = aws_eip.bastion2.id
resource "aws_eip_association" "bastion" {
network_interface_id = aws_network_interface.bastion.id
allocation_id = aws_eip.bastion.id
}

// Create the bastion.infra.rust-lang.org DNS record.
Expand All @@ -30,11 +25,11 @@ data "aws_route53_zone" "rust_lang_org" {
name = "rust-lang.org"
}

resource "aws_route53_record" "bastion2" {
resource "aws_route53_record" "bastion" {
zone_id = data.aws_route53_zone.rust_lang_org.id
name = "bastion.infra.rust-lang.org"
type = "A"
records = [aws_eip.bastion2.public_ip]
records = [aws_eip.bastion.public_ip]
ttl = 300
}

Expand All @@ -55,7 +50,7 @@ data "aws_ami" "ubuntu24" {
}
}

resource "aws_instance" "bastion2" {
resource "aws_instance" "bastion" {
ami = data.aws_ami.ubuntu24.id
instance_type = "t3a.micro"
key_name = data.terraform_remote_state.shared.outputs.master_ec2_key_pair
Expand All @@ -70,12 +65,12 @@ resource "aws_instance" "bastion2" {
}

network_interface {
network_interface_id = aws_network_interface.bastion2.id
network_interface_id = aws_network_interface.bastion.id
device_index = 0
}

tags = {
Name = "bastion2"
Name = "bastion"
Service = "bastion"
}

Expand Down

0 comments on commit 46c4fe6

Please sign in to comment.