-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathvpc.tf
49 lines (37 loc) · 900 Bytes
/
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
resource "aws_vpc" "test0-vpc" {
cidr_block = var.vpc_cidr
enable_dns_hostnames = true
tags = {
Name = "TEST-VPC"
}
}
resource "aws_security_group" "rdssg" {
name = "rdssg"
vpc_id = aws_vpc.test0-vpc.id
ingress {
from_port = 3306
to_port = 3306
protocol = "tcp"
cidr_blocks = ["0.0.0.0/0"]
}
}
resource "aws_internet_gateway" "gw" {
vpc_id = aws_vpc.test0-vpc.id
tags = {
Name = "main"
}
}
resource "aws_route_table" "example" {
vpc_id = "${aws_vpc.test0-vpc.id}"
route {
cidr_block = "0.0.0.0/0"
gateway_id = "${aws_internet_gateway.gw.id}"
}
tags = {
Name = "routing"
}
}
resource "aws_route_table_association" "assoc" {
subnet_id = "${aws_subnet.subnet_2.id}"
route_table_id = "${aws_route_table.example.id}"
}