-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvpc.tf
executable file
·70 lines (54 loc) · 1.36 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
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
#######
# VPC #
#######
##### Availability Zone A #####
## PUBLIC ##
resource "aws_subnet" "publicA" {
vpc_id = "${aws_vpc.simple.id}"
availability_zone = "${data.aws_region.current.name}a"
cidr_block = "172.30.0.0/24"
map_public_ip_on_launch = "true"
tags {
Name = "Simple Public A"
}
}
resource "aws_route_table_association" "publicA" {
subnet_id = "${aws_subnet.publicA.id}"
route_table_id = "${aws_route_table.public.id}"
}
##### Other Infrastructure #####
resource "aws_vpc" "simple" {
cidr_block = "172.30.0.0/16"
enable_dns_support = "true"
enable_dns_hostnames = "true"
tags {
Name = "Simple"
}
}
resource "aws_vpc_dhcp_options_association" "simple" {
vpc_id = "${aws_vpc.simple.id}"
dhcp_options_id = "${aws_vpc_dhcp_options.simple.id}"
}
resource "aws_vpc_dhcp_options" "simple" {
domain_name = "${data.aws_region.current.name}.compute.internal"
domain_name_servers = ["AmazonProvidedDNS"]
tags {
Name = "Simple"
}
}
resource "aws_internet_gateway" "simple" {
vpc_id = "${aws_vpc.simple.id}"
tags {
Name = "Simple Gateway"
}
}
resource "aws_route_table" "public" {
vpc_id = "${aws_vpc.simple.id}"
route {
cidr_block = "0.0.0.0/0"
gateway_id = "${aws_internet_gateway.simple.id}"
}
tags {
Name = "Simple Public"
}
}