Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 16 additions & 5 deletions terraform/rds-databases/instance.tf
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,15 @@ resource "aws_db_subnet_group" "public" {
# All of this security group stuff should go away once we migrate bastion to the
# prod vpc (vs. the legacy vpc).

data "terraform_remote_state" "rustc_perf" {
backend = "s3"
config = {
bucket = "rust-terraform"
key = "simpleinfra/rustc-perf.tfstate"
region = "us-west-1"
}
}

data "aws_security_group" "bastion" {
vpc_id = data.terraform_remote_state.shared.outputs.prod_vpc.id
name = "rust-prod-bastion"
Expand Down Expand Up @@ -43,11 +52,13 @@ resource "aws_security_group" "rust_prod_db" {
}

ingress {
from_port = 5432
to_port = 5432
protocol = "tcp"
cidr_blocks = ["159.69.58.186/32"]
description = "Connections from rustc-perf collection server"
from_port = 5432
to_port = 5432
protocol = "tcp"
cidr_blocks = [
for ip in data.terraform_remote_state.rustc_perf.outputs.rustc_perf_ips : "${ip}/32"
]
description = "Connections from rustc-perf collection servers"
}

tags = {
Expand Down
7 changes: 7 additions & 0 deletions terraform/rustc-perf/dns.tf
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,10 @@ resource "aws_route53_record" "one" {
records = ["144.76.186.39"]
ttl = 300
}

output "rustc_perf_ips" {
value = [
tolist(aws_route53_record.legacy.records)[0],
tolist(aws_route53_record.one.records)[0]
]
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

move this to a outputs.tf file