forked from hol-workshop/migrate_to_atp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vcn.tf
186 lines (180 loc) · 5.58 KB
/
vcn.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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
#VCN
resource oci_core_vcn holvcn {
compartment_id = var.compartment_ocid
cidr_block = var.holvcn_cidr_block
dns_label = var.holvcn_dns_label
display_name = var.holvcn_display_name
}
#PUBLIC SUBNET
resource "oci_core_subnet" "holvcn_public_subnet" {
compartment_id = var.compartment_ocid
vcn_id = oci_core_vcn.holvcn.id
cidr_block = var.holvcn_public_cidr_block
dns_label = var.holvcn_public_dns_label
display_name = var.holvcn_public_subnet_display_name
security_list_ids = [oci_core_security_list.holvcn_public_security_list.id]
}
resource "oci_core_route_table_attachment" "holvcn_public_route_attachment" {
subnet_id = oci_core_subnet.holvcn_public_subnet.id
route_table_id = oci_core_route_table.holvcn_public_route_table.id
}
#PRIVATE SUBNET
resource "oci_core_subnet" "holvcn_private_subnet" {
compartment_id = var.compartment_ocid
vcn_id = oci_core_vcn.holvcn.id
cidr_block = var.holvcn_private_cidr_block
dns_label = var.holvcn_private_dns_label
display_name = var.holvcn_private_subnet_display_name
security_list_ids = [oci_core_security_list.holvcn_private_security_list.id]
}
resource "oci_core_route_table_attachment" "holvcn_private_route_attachment" {
subnet_id = oci_core_subnet.holvcn_private_subnet.id
route_table_id = oci_core_route_table.holvcn_private_route_table.id
}
#Public RT
resource "oci_core_route_table" "holvcn_public_route_table" {
compartment_id = var.compartment_ocid
display_name = var.holvcn_public_route_table_display_name
vcn_id = oci_core_vcn.holvcn.id
route_rules {
network_entity_id = oci_core_internet_gateway.holvcn_igw.id
destination = var.holvcn_igw_cidr_block
destination_type = "CIDR_BLOCK"
}
}
#Private RT
resource "oci_core_route_table" "holvcn_private_route_table" {
compartment_id = var.compartment_ocid
display_name = var.holvcn_private_route_table_display_name
vcn_id = oci_core_vcn.holvcn.id
route_rules {
network_entity_id = oci_core_nat_gateway.holvcn_nat.id
destination = var.holvcn_nat_cidr_block
destination_type = "CIDR_BLOCK"
}
}
#IGW
resource "oci_core_internet_gateway" "holvcn_igw" {
compartment_id = var.compartment_ocid
vcn_id = oci_core_vcn.holvcn.id
enabled = "true"
display_name = var.holvcn_igw_display_name
}
#NAT
resource "oci_core_nat_gateway" "holvcn_nat" {
compartment_id = var.compartment_ocid
vcn_id = oci_core_vcn.holvcn.id
display_name = var.holvcn_nat_display_name
}
#Public SL
resource "oci_core_security_list" "holvcn_public_security_list" {
display_name = var.holvcn_public_security_list_display_name
compartment_id = var.compartment_ocid
vcn_id = oci_core_vcn.holvcn.id
egress_security_rules {
destination = var.holvcn_igw_cidr_block
protocol = "all"
}
ingress_security_rules {
protocol = "6"
source = var.holvcn_igw_cidr_block
source_type = "CIDR_BLOCK"
tcp_options {
max = 22
min = 22
}
}
ingress_security_rules {
protocol = "6"
source = var.holvcn_igw_cidr_block
source_type = "CIDR_BLOCK"
description = "Web ports"
tcp_options {
max = 80
min = 80
}
}
ingress_security_rules {
protocol = "6"
source = var.holvcn_igw_cidr_block
source_type = "CIDR_BLOCK"
description = "Web ports"
tcp_options {
max = 443
min = 443
}
}
ingress_security_rules {
protocol = "6"
source = var.holvcn_igw_cidr_block
source_type = "CIDR_BLOCK"
description = "Goldengate microservices ports"
tcp_options {
max = 9014
min = 9011
}
}
ingress_security_rules {
protocol = "6"
source = var.holvcn_igw_cidr_block
source_type = "CIDR_BLOCK"
description = "Goldengate microservice ports"
tcp_options {
max = 9024
min = 9021
}
}
ingress_security_rules {
protocol = "6"
source = var.holvcn_igw_cidr_block
source_type = "CIDR_BLOCK"
description = "Goldengate Classic ports"
tcp_options {
max = 7811
min = 7809
}
}
ingress_security_rules {
protocol = "6"
source = var.holvcn_igw_cidr_block
source_type = "CIDR_BLOCK"
description = "Database ports"
tcp_options {
max = 1522
min = 1521
}
}
ingress_security_rules {
protocol = "6"
source = var.holvcn_igw_cidr_block
source_type = "CIDR_BLOCK"
#description = "Postgresql port"
tcp_options {
max = 5432
min = 5432
}
}
}
#Private SL
resource "oci_core_security_list" "holvcn_private_security_list" {
display_name = var.holvcn_private_security_list_display_name
compartment_id = var.compartment_ocid
vcn_id = oci_core_vcn.holvcn.id
egress_security_rules {
destination = var.holvcn_nat_cidr_block
protocol = "all"
}
ingress_security_rules {
source = var.holvcn_cidr_block
protocol = "all"
}
ingress_security_rules {
protocol = "6"
source = var.holvcn_cidr_block
source_type = "CIDR_BLOCK"
tcp_options {
max = 22
min = 22
}
}
}