forked from raushan8586/raushan_simplilearn_repo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain_terraform.tf
67 lines (54 loc) · 1.22 KB
/
main_terraform.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 3.0"
}
}
}
# Configure the AWS Provider
provider "aws" {
region = "ap-northeast-1"
}
# Create a VPC
resource "aws_vpc" "simplilearn-VPC" {
cidr_block = "10.0.0.0/16"
tags = {
Name = "simplilearn-VPC"
}
}
# Create Subnet
resource "aws_subnet" "simplilearn-Subnet1" {
vpc_id = aws_vpc.simplilearn-VPC.id
cidr_block = "10.0.0.0/24"
tags = {
Name = "simplilearn-Subnet1"
}
}
# Create Internet Gateway
resource "aws_internet_gateway" "simplilearn-IntGW" {
vpc_id = aws_vpc.simplilearn-VPC.id
tags = {
Name = "simplilearn-IntGW"
}
}
resource "aws_security_group" "simplilearn-sg" {
name = "simplilearn-sg"
description = "Allow ssh inbound traffic"
vpc_id = aws_vpc.simplilearn-VPC.id
ingress {
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"]
}
tags = {
Name = "simplilearn-sg"
}
}