Last active
November 30, 2018 15:18
-
-
Save himlohiya/4e94a61f08a710da84a914760c15d9dc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
data "aws_ip_ranges" "european_ec2" { | |
regions = [ | |
"eu-west-1", | |
"eu-central-1" | |
] | |
services = [ | |
"ec2" | |
] | |
} | |
resource "aws_security_group" "allow-ssh" { | |
vpc_id = "${aws_vpc.main.id}" | |
name = "allow-ssh" | |
description = "security group that allows ssh and all egress traffic" | |
egress { | |
from_port = 0 | |
to_port = 0 | |
protocol = "-1" | |
cidr_blocks = ["0.0.0.0/0"] | |
} | |
ingress { | |
from_port = 22 | |
to_port = 22 | |
protocol = "tcp" | |
cidr_blocks = [ | |
"0.0.0.0/0", | |
"${data.aws_ip_ranges.european_ec2.cidr_blocks}" | |
] | |
} | |
tags { | |
Name = "allow-ssh", | |
CreateDate = "${data.aws_ip_ranges.european_ec2.create_date}", | |
SyncToken = "${data.aws_ip_ranges.european_ec2.sync_token}" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment