add a security group to enable SSH, HTTP, and HTTPS

Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
Jakub Sokołowski 2019-05-28 17:37:47 -04:00
parent e08ad869e9
commit 9512baab07
No known key found for this signature in database
GPG Key ID: 4EF064D0E6D63020
1 changed files with 33 additions and 0 deletions

33
main.tf
View File

@ -141,12 +141,45 @@ data "aws_ami" "ubuntu" {
owners = ["099720109477"]
}
resource "aws_security_group" "dap_ps_dev" {
name = "default-webserver"
description = "Allow SSH, HTTP and HTTPS"
ingress {
from_port = 22
to_port = 22
protocol = "tcp"
cidr_blocks = ["0.0.0.0/0"]
}
ingress {
from_port = 80
to_port = 80
protocol = "tcp"
cidr_blocks = ["0.0.0.0/0"]
}
ingress {
from_port = 443
to_port = 443
protocol = "tcp"
cidr_blocks = ["0.0.0.0/0"]
}
egress {
from_port = 0
to_port = 0
protocol = "-1"
cidr_blocks = ["0.0.0.0/0"]
}
}
resource "aws_instance" "dap_ps_dev" {
ami = "${data.aws_ami.ubuntu.id}"
instance_type = "${var.instance_type}"
availability_zone = "${var.zone}"
key_name = "${aws_key_pair.admin.key_name}"
security_groups = ["${aws_security_group.dap_ps_dev.name}"]
tags = {
Name = "node-01.${var.zone}.${var.env}.test"
}