-
Notifications
You must be signed in to change notification settings - Fork 85
/
Copy pathmain.tf
80 lines (67 loc) · 1.48 KB
/
main.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
68
69
70
71
72
73
74
75
76
77
78
79
80
terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = "4.62.0"
}
}
}
provider "aws" {
region = "ap-south-1"
access_key = "AKIA4LM34PDX2KEIH5EC"
secret_key = "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"
}
# Create a VPC
resource "aws_vpc" "intellipaat-vpc" {
cidr_block = "10.0.0.0/16"
instance_tenancy = "default"
tags = {
Name = "intellipaat-vpc"
}
}
# Create a Subnet1
resource "aws_subnet" "subnet1" {
vpc_id = aws_vpc.intellipaat-vpc.id
cidr_block = "10.0.1.0/24"
tags = {
Name = "subnet1"
}
}
# Create a Subnet2
resource "aws_subnet" "subnet2" {
vpc_id = aws_vpc.intellipaat-vpc.id
cidr_block = "10.0.0.0/24"
tags = {
Name = "subnet2"
}
}
# Create Internet Gateway and attach to VPC
resource "aws_internet_gateway" "igw-intellipaat" {
vpc_id = aws_vpc.intellipaat-vpc.id
tags = {
Name = "igw-intellipaat"
}
}
# Create Security Group
resource "aws_security_group" "tls-intellipaat" {
name = "tls-intellipaat"
description = "Allow TLS inbound traffic"
vpc_id = aws_vpc.intellipaat-vpc.id
ingress {
description = "TLS from VPC"
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"]
ipv6_cidr_blocks = ["::/0"]
}
tags = {
Name = "tls-intellipaat"
}
}