-
Notifications
You must be signed in to change notification settings - Fork 0
/
vpc.tf
41 lines (36 loc) · 1.13 KB
/
vpc.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
resource "aws_vpc" "infrastructure_vpc" {
cidr_block = var.vpc_cidr
enable_dns_support = "true" #gives you an internal domain name
enable_dns_hostnames = "true" #gives you an internal host name
instance_tenancy = "default"
tags = {
Name = "asg-vpc"
}
}
#It enables our vpc to connect to the internet
resource "aws_internet_gateway" "infrastructure_igw" {
vpc_id = aws_vpc.infrastructure_vpc.id
tags = {
Name = "asg-igw"
}
}
#first public subnet
resource "aws_subnet" "first_public_subnet" {
vpc_id = aws_vpc.infrastructure_vpc.id
cidr_block = var.subnet_cidrs[1]
map_public_ip_on_launch = "true" //it makes this a public subnet
availability_zone = var.availability_zone[1]
tags = {
Name = "first public subnet"
}
}
#second public subnet
resource "aws_subnet" "second_public_subnet" {
vpc_id = aws_vpc.infrastructure_vpc.id
cidr_block = var.subnet_cidrs[0]
map_public_ip_on_launch = "true" //it makes this a public subnet
availability_zone = var.availability_zone[0]
tags = {
Name = "second public subnet"
}
}