Skip to content

Commit

Permalink
Se agrega el proyecto ec2-with-sg
Browse files Browse the repository at this point in the history
  • Loading branch information
gilbarsan01 committed Oct 15, 2019
1 parent dfec390 commit ff27402
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 0 deletions.
10 changes: 10 additions & 0 deletions ec2-with-sg/instancia.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
resource "aws_instance" "web" {

ami = "ami-082b5a644766e0e6f"
instance_type = "t2.micro"
key_name = "ec2-amazon01"

vpc_security_group_ids = [ "${aws_security_group.allow_ssh_anywhere.id}" ]

}

3 changes: 3 additions & 0 deletions ec2-with-sg/provider.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
provider "aws" {
region = "us-west-2"
}
24 changes: 24 additions & 0 deletions ec2-with-sg/sg.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#Generar security group en VPC por default.
# el valor vpc_id = "vpc-f8ba509c" - Es el ID de la VPC por default.

resource "aws_security_group" "allow_ssh_anywhere" {
name = "allow_ssh_anywhere"
description = "Allow all inbound traffic ssh"
vpc_id = "vpc-f8ba509c"

ingress {
# TLS (change to whatever ports you need)
from_port = 22
to_port = 22
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"]
}
}

0 comments on commit ff27402

Please sign in to comment.