File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change 1
1
locals {
2
2
security_group_name_prefix = " github-runner-sg"
3
+ security_group_description = " Allow ssh ingress within vpc and all egress traffic"
3
4
ubuntu_instance_name = " github-runner"
4
5
instance_type = " t2.micro"
5
6
}
6
7
8
+ data "aws_vpc" "vpc" {
9
+ id = var. vpc_id
10
+ }
11
+
7
12
resource "aws_instance" "github_runner" {
8
13
ami = var. ami_id
9
14
instance_type = local. instance_type
@@ -27,14 +32,14 @@ resource "aws_instance" "github_runner" {
27
32
28
33
resource "aws_security_group" "github_runner" {
29
34
name_prefix = local. security_group_name_prefix
30
- description = " Allow ssh ingress and all egress traffic "
35
+ description = local . security_group_description
31
36
vpc_id = var. vpc_id
32
37
33
38
ingress {
34
39
from_port = 22
35
40
to_port = 22
36
41
protocol = " tcp"
37
- cidr_blocks = [" 0.0.0.0/0 " ]
42
+ cidr_blocks = [data . aws_vpc . vpc . cidr_block ]
38
43
}
39
44
40
45
egress {
You can’t perform that action at this time.
0 commit comments