-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.tf
More file actions
30 lines (27 loc) · 800 Bytes
/
Copy pathmain.tf
File metadata and controls
30 lines (27 loc) · 800 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
resource "aws_vpc" "tfb" {
cidr_block = var.cidr
enable_dns_hostnames = var.enable_dns_hostnames
enable_dns_support = var.enable_dns_support
tags = {
Name = var.name
}
}
resource "aws_internet_gateway" "tfb" {
vpc_id = aws_vpc.tfb.id
tags = {
Name = "${var.name}-igw"
}
}
resource "aws_route" "internet_access" {
route_table_id = aws_vpc.tfb.main_route_table_id
destination_cidr_block = "0.0.0.0/0"
gateway_id = aws_internet_gateway.tfb.id
}
resource "aws_subnet" "public" {
vpc_id = aws_vpc.tfb.id
cidr_block = var.public_subnet
map_public_ip_on_launch = var.map_public_ip_on_launch
tags = {
Name = "${var.name}-public"
}
}