Skip to content

Commit

Permalink
Merge pull request #610 from rust-lang/allow-bastion2-to-access-the-p…
Browse files Browse the repository at this point in the history
…layground

allow bastion2 to access the playground
  • Loading branch information
MarcoIeni authored Oct 8, 2024
2 parents 90b1e8a + da702b3 commit d3b6911
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions terraform/playground/instance.tf
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ data "dns_a_record_set" "bastion" {
host = "bastion.infra.rust-lang.org"
}

data "dns_a_record_set" "bastion2" {
host = "bastion2.infra.rust-lang.org"
}

resource "aws_security_group" "playground" {
vpc_id = data.terraform_remote_state.shared.outputs.prod_vpc.id
name = "rust-prod-playground"
Expand Down Expand Up @@ -42,6 +46,28 @@ resource "aws_security_group" "playground" {
}
}

dynamic "ingress" {
for_each = toset(data.dns_a_record_set.bastion2.addrs)
content {
from_port = 22
to_port = 22
protocol = "tcp"
cidr_blocks = ["${ingress.value}/32"]
description = "SSH from the bastion"
}
}

dynamic "ingress" {
for_each = toset(data.dns_a_record_set.bastion2.addrs)
content {
from_port = -1
to_port = -1
protocol = "icmp"
cidr_blocks = ["${ingress.value}/32"]
description = "ICMP from the bastion"
}
}

// node_exporter access from the monitoring instance
dynamic "ingress" {
for_each = toset(data.dns_a_record_set.monitoring.addrs)
Expand Down

0 comments on commit d3b6911

Please sign in to comment.