Skip to content

Commit 5503e12

Browse files
mattgodboltclaude
andauthored
Replace hardcoded CI security group IDs with data sources (#1867)
Co-authored-by: Claude <[email protected]>
1 parent c556d68 commit 5503e12

File tree

1 file changed

+25
-4
lines changed

1 file changed

+25
-4
lines changed

terraform/security.tf

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -694,9 +694,9 @@ resource "aws_security_group_rule" "efs_inbound" {
694694
for_each = {
695695
"Admin" = aws_security_group.AdminNode.id,
696696
"Compilation" = aws_security_group.CompilerExplorer.id
697-
"CI-x64" = "sg-07a8509aae61cbe4f"
698-
"CI-arm64" = "sg-0d3a3411b05a2bfb4"
699-
"CI-lin-builder-x64" = "sg-06fc1097fde032d6e"
697+
"CI-x64" = data.aws_security_group.linux_x64.id
698+
"CI-arm64" = data.aws_security_group.linux_arm64.id
699+
"CI-lin-builder-x64" = data.aws_security_group.linux_x64_builder.id
700700
}
701701
security_group_id = aws_security_group.efs.id
702702
type = "ingress"
@@ -779,14 +779,35 @@ resource "aws_iam_role_policy_attachment" "api_gw_logging_policy" {
779779
}
780780

781781

782-
# Look up Windows builder security group created by ce-ci terraform
782+
# Look up CI runner security groups created by ce-ci terraform
783783
data "aws_security_group" "windows_builder" {
784784
filter {
785785
name = "tag:ghr:environment"
786786
values = ["ce-ci-windows-x64-win-builder"]
787787
}
788788
}
789789

790+
data "aws_security_group" "linux_x64" {
791+
filter {
792+
name = "tag:ghr:environment"
793+
values = ["ce-ci-linux-x64"]
794+
}
795+
}
796+
797+
data "aws_security_group" "linux_arm64" {
798+
filter {
799+
name = "tag:ghr:environment"
800+
values = ["ce-ci-linux-arm64"]
801+
}
802+
}
803+
804+
data "aws_security_group" "linux_x64_builder" {
805+
filter {
806+
name = "tag:ghr:environment"
807+
values = ["ce-ci-linux-x64-builder"]
808+
}
809+
}
810+
790811
resource "aws_security_group_rule" "WinBuilder_SmbLocally" {
791812
security_group_id = aws_security_group.CompilerExplorer.id
792813
type = "ingress"

0 commit comments

Comments
 (0)