-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathvpc.tf
More file actions
45 lines (40 loc) · 976 Bytes
/
vpc.tf
File metadata and controls
45 lines (40 loc) · 976 Bytes
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
data "aws_availability_zones" "az" {
state = "available"
}
resource "aws_vpc" "vpc-tf" {
cidr_block = var.vpc_cidr
enable_dns_hostnames = true
enable_dns_support = true
tags = {
Name = "vpc-tf"
user = "pchandaliya"
}
}
resource "aws_subnet" "subnet-tf" {
vpc_id = aws_vpc.vpc-tf.id
cidr_block = var.subnet1_cidr
map_public_ip_on_launch = true
availability_zone = element(data.aws_availability_zones.az.names, 0)
tags = {
Name = "subnet-tf"
user = "pchandaliya"
}
}
resource "aws_internet_gateway" "igw" {
vpc_id = aws_vpc.vpc-tf.id
tags = {
Name = "igw-tf"
user = "pchandaliya"
}
}
resource "aws_default_route_table" "internet_route_table" {
default_route_table_id = aws_vpc.vpc-tf.default_route_table_id
route {
cidr_block = var.rt_cidr
gateway_id = aws_internet_gateway.igw.id
}
tags = {
Name = "default-route-table"
user = "pchandaliya"
}
}