-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.tf
74 lines (59 loc) · 1.52 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
resource "aws_vpc" "aws_test" {
cidr_block = "10.252.0.0/16"
enable_dns_hostnames = true
enable_dns_support = true
tags = {
Name = "aws_test"
}
}
resource "aws_subnet" "aws_test_subnet" {
vpc_id = aws_vpc.aws_test.id
cidr_block = "10.252.1.0/24"
map_public_ip_on_launch = true
availability_zone = "us-west-2b"
tags = {
Name = "aws_test-public"
}
}
resource "aws_internet_gateway" "aws_test_igw" {
vpc_id = aws_vpc.aws_test.id
tags = {
Name = "aws_test_igw"
}
}
resource "aws_route_table" "aws_test_rt" {
vpc_id = aws_vpc.aws_test.id
tags = {
Name = "aws_test_public_rt"
}
}
resource "aws_route" "aws_test_default_rt" {
route_table_id = aws_route_table.aws_test_rt.id
destination_cidr_block = "0.0.0.0/0"
gateway_id = aws_internet_gateway.aws_test_igw.id
}
resource "aws_route_table_association" "aws_test_rt_assoc" {
subnet_id = aws_subnet.aws_test_subnet.id
route_table_id = aws_route_table.aws_test_rt.id
}
resource "aws_security_group" "aws_test_sg" {
name = "aws_test_sg"
description = "aws_test security group"
vpc_id = aws_vpc.aws_test.id
ingress {
from_port = 0
to_port = 0
protocol = "-1"
cidr_blocks = ["0.0.0.0/0"]
}
egress {
from_port = 0
to_port = 0
protocol = "-1"
cidr_blocks = ["0.0.0.0/0"]
}
}
resource "aws_key_pair" "aws_test_key" {
key_name = "aws_test_key"
public_key = file("~/.ssh/aws_test_key.pub")
}