Skip to content

Commit 7b8817a

Browse files
committed
Terraform examples for provisioning OCVS
1 parent 5090c1f commit 7b8817a

40 files changed

+2090
-87
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
data "oci_identity_availability_domains" "export_availability_domains" {
2+
compartment_id = var.compartment_ocid
3+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
resource "oci_core_nat_gateway" "sddc_nat_gateway" {
2+
compartment_id = var.compartment_ocid
3+
vcn_id = oci_core_vcn.export_sddc_vcn.id
4+
display_name = "SDDC-NAT-Gateway"
5+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,302 @@
1+
2+
# --[ VLAN Edge Uplink 1 ]--------------------------------------------------
3+
resource oci_core_network_security_group export_UPLINK1_nsg {
4+
compartment_id = var.compartment_ocid
5+
display_name = "NSG for Uplink1"
6+
vcn_id = oci_core_vcn.export_sddc_vcn.id
7+
}
8+
9+
resource oci_core_network_security_group_security_rule export_NSG-UPLINK1-rule_1 {
10+
description = "Allow traffic from VCN"
11+
destination_type = ""
12+
direction = "INGRESS"
13+
network_security_group_id = oci_core_network_security_group.export_UPLINK1_nsg.id
14+
protocol = "all"
15+
source = var.vcn_cidr
16+
source_type = "CIDR_BLOCK"
17+
stateless = "false"
18+
}
19+
20+
resource oci_core_network_security_group_security_rule export_NSG-UPLINK1-rule_2 {
21+
description = "Allow traffic to VCN"
22+
destination = var.vcn_cidr
23+
destination_type = "CIDR_BLOCK"
24+
direction = "EGRESS"
25+
network_security_group_id = oci_core_network_security_group.export_UPLINK1_nsg.id
26+
protocol = "all"
27+
source_type = ""
28+
stateless = "false"
29+
}
30+
31+
# --[ VLAN Edge Uplink 2 ]--------------------------------------------------
32+
# Uplink2 is unused by default, so no rules specified
33+
resource oci_core_network_security_group export_UPLINK2_nsg {
34+
compartment_id = var.compartment_ocid
35+
display_name = "NSG for Uplink2"
36+
vcn_id = oci_core_vcn.export_sddc_vcn.id
37+
}
38+
39+
resource oci_core_network_security_group_security_rule export_NSG-UPLINK2-rule_1 {
40+
description = "Allow traffic from VCN"
41+
destination_type = ""
42+
direction = "INGRESS"
43+
network_security_group_id = oci_core_network_security_group.export_UPLINK2_nsg.id
44+
protocol = "all"
45+
source = var.vcn_cidr
46+
source_type = "CIDR_BLOCK"
47+
stateless = "false"
48+
}
49+
50+
resource oci_core_network_security_group_security_rule export_NSG-UPLINK2-rule_2 {
51+
description = "Allow traffic to VCN"
52+
destination = var.vcn_cidr
53+
destination_type = "CIDR_BLOCK"
54+
direction = "EGRESS"
55+
network_security_group_id = oci_core_network_security_group.export_UPLINK2_nsg.id
56+
protocol = "all"
57+
source_type = ""
58+
stateless = "false"
59+
}
60+
61+
# --[ VLAN EdgeVTEP ]--------------------------------------------------
62+
resource oci_core_network_security_group export_EdgeVTEP_nsg {
63+
compartment_id = var.compartment_ocid
64+
display_name = "NSG for Edge VTEP"
65+
vcn_id = oci_core_vcn.export_sddc_vcn.id
66+
}
67+
68+
resource oci_core_network_security_group_security_rule export_NSG-EdgeVTEP-rule_1 {
69+
description = "Allow traffic from VCN"
70+
destination_type = ""
71+
direction = "INGRESS"
72+
network_security_group_id = oci_core_network_security_group.export_EdgeVTEP_nsg.id
73+
protocol = "all"
74+
source = var.vcn_cidr
75+
source_type = "CIDR_BLOCK"
76+
stateless = "false"
77+
}
78+
79+
resource oci_core_network_security_group_security_rule export_NSG-EdgeVTEP-rule_2 {
80+
description = "Allow traffic to VCN"
81+
destination = var.vcn_cidr
82+
destination_type = "CIDR_BLOCK"
83+
direction = "EGRESS"
84+
network_security_group_id = oci_core_network_security_group.export_EdgeVTEP_nsg.id
85+
protocol = "all"
86+
source_type = ""
87+
stateless = "false"
88+
}
89+
90+
# --[ VLAN VTEP ]--------------------------------------------------
91+
resource oci_core_network_security_group export_VTEP_nsg {
92+
compartment_id = var.compartment_ocid
93+
display_name = "NSX for VTEP"
94+
vcn_id = oci_core_vcn.export_sddc_vcn.id
95+
}
96+
97+
resource oci_core_network_security_group_security_rule export_NSG-VTEP-rule_1 {
98+
description = "Allow traffic from VCN"
99+
destination_type = ""
100+
direction = "INGRESS"
101+
network_security_group_id = oci_core_network_security_group.export_VTEP_nsg.id
102+
protocol = "all"
103+
source = var.vcn_cidr
104+
source_type = "CIDR_BLOCK"
105+
stateless = "false"
106+
}
107+
108+
resource oci_core_network_security_group_security_rule export_NSG-VTEP-rule_2 {
109+
description = "Allow traffic to VCN"
110+
destination = var.vcn_cidr
111+
destination_type = "CIDR_BLOCK"
112+
direction = "EGRESS"
113+
network_security_group_id = oci_core_network_security_group.export_VTEP_nsg.id
114+
protocol = "all"
115+
source_type = ""
116+
stateless = "false"
117+
}
118+
119+
# --[ VLAN vMOTION ]--------------------------------------------------
120+
resource oci_core_network_security_group export_vMOTION_nsg {
121+
compartment_id = var.compartment_ocid
122+
display_name = "NSG for vMotion"
123+
vcn_id = oci_core_vcn.export_sddc_vcn.id
124+
}
125+
126+
resource oci_core_network_security_group_security_rule export_NSG-vMOTION-rule_1 {
127+
description = "Allow traffic from VCN"
128+
destination_type = ""
129+
direction = "INGRESS"
130+
network_security_group_id = oci_core_network_security_group.export_vMOTION_nsg.id
131+
protocol = "all"
132+
source = var.vcn_cidr
133+
source_type = "CIDR_BLOCK"
134+
stateless = "false"
135+
}
136+
137+
resource oci_core_network_security_group_security_rule export_NSG-vMOTION-rule_2 {
138+
description = "Allow traffic to VCN"
139+
destination = var.vcn_cidr
140+
destination_type = "CIDR_BLOCK"
141+
direction = "EGRESS"
142+
network_security_group_id = oci_core_network_security_group.export_vMOTION_nsg.id
143+
protocol = "all"
144+
source_type = ""
145+
stateless = "false"
146+
}
147+
148+
# --[ VLAN vSAN ]--------------------------------------------------
149+
resource oci_core_network_security_group export_vSAN_nsg {
150+
compartment_id = var.compartment_ocid
151+
display_name = "NSG for vSAN"
152+
vcn_id = oci_core_vcn.export_sddc_vcn.id
153+
}
154+
155+
resource oci_core_network_security_group_security_rule export_NSG-vSAN-rule_1 {
156+
description = "Allow traffic from VCN"
157+
destination_type = ""
158+
direction = "INGRESS"
159+
network_security_group_id = oci_core_network_security_group.export_vSAN_nsg.id
160+
protocol = "all"
161+
source = var.vcn_cidr
162+
source_type = "CIDR_BLOCK"
163+
stateless = "false"
164+
}
165+
166+
resource oci_core_network_security_group_security_rule export_NSG-vSAN-rule_2 {
167+
description = "Allow traffic to VCN"
168+
destination = var.vcn_cidr
169+
destination_type = "CIDR_BLOCK"
170+
direction = "EGRESS"
171+
network_security_group_id = oci_core_network_security_group.export_vSAN_nsg.id
172+
protocol = "all"
173+
source_type = ""
174+
stateless = "false"
175+
}
176+
177+
# --[ VLAN vSPHERE ]--------------------------------------------------
178+
resource oci_core_network_security_group export_vSPHERE_nsg {
179+
compartment_id = var.compartment_ocid
180+
display_name = "NSG for vSphere"
181+
vcn_id = oci_core_vcn.export_sddc_vcn.id
182+
}
183+
184+
resource oci_core_network_security_group_security_rule export_NSG-vSPHERE-rule_1 {
185+
description = "Allow traffic from VCN"
186+
destination_type = ""
187+
direction = "INGRESS"
188+
network_security_group_id = oci_core_network_security_group.export_vSPHERE_nsg.id
189+
protocol = "all"
190+
source = var.vcn_cidr
191+
source_type = "CIDR_BLOCK"
192+
stateless = "false"
193+
}
194+
195+
resource oci_core_network_security_group_security_rule export_NSG-vSPHERE-rule_2 {
196+
description = "Allow traffic to VCN"
197+
destination = var.vcn_cidr
198+
destination_type = "CIDR_BLOCK"
199+
direction = "EGRESS"
200+
network_security_group_id = oci_core_network_security_group.export_vSPHERE_nsg.id
201+
protocol = "all"
202+
source_type = ""
203+
stateless = "false"
204+
}
205+
206+
resource oci_core_network_security_group_security_rule export_NSG-vSPHERE-rule_3 {
207+
description = "Allow traffic to Internet"
208+
destination = "0.0.0.0/0"
209+
destination_type = "CIDR_BLOCK"
210+
direction = "EGRESS"
211+
network_security_group_id = oci_core_network_security_group.export_vSPHERE_nsg.id
212+
protocol = "all"
213+
source_type = ""
214+
stateless = "false"
215+
}
216+
217+
# --[ VLAN HCX ]--------------------------------------------------
218+
resource oci_core_network_security_group export_HCX_nsg {
219+
compartment_id = var.compartment_ocid
220+
display_name = "NSG for HCX"
221+
vcn_id = oci_core_vcn.export_sddc_vcn.id
222+
}
223+
224+
resource oci_core_network_security_group_security_rule export_NSG-HCX-rule_1 {
225+
description = "Allow traffic from VCN"
226+
destination_type = ""
227+
direction = "INGRESS"
228+
network_security_group_id = oci_core_network_security_group.export_HCX_nsg.id
229+
protocol = "all"
230+
source = var.vcn_cidr
231+
source_type = "CIDR_BLOCK"
232+
stateless = "false"
233+
}
234+
235+
resource oci_core_network_security_group_security_rule export_NSG-HCX-rule_2 {
236+
description = "Allow traffic to VCN"
237+
destination = var.vcn_cidr
238+
destination_type = "CIDR_BLOCK"
239+
direction = "EGRESS"
240+
network_security_group_id = oci_core_network_security_group.export_HCX_nsg.id
241+
protocol = "all"
242+
source_type = ""
243+
stateless = "false"
244+
}
245+
246+
# --[ VLAN ReplicationNET ]--------------------------------------------------
247+
resource oci_core_network_security_group export_ReplicationNET_nsg {
248+
compartment_id = var.compartment_ocid
249+
display_name = "NSX for ReplicationNet"
250+
vcn_id = oci_core_vcn.export_sddc_vcn.id
251+
}
252+
253+
resource oci_core_network_security_group_security_rule export_NSG-ReplicationNET-rule_1 {
254+
description = "Allow traffic from VCN"
255+
destination_type = ""
256+
direction = "INGRESS"
257+
network_security_group_id = oci_core_network_security_group.export_ReplicationNET_nsg.id
258+
protocol = "all"
259+
source = var.vcn_cidr
260+
source_type = "CIDR_BLOCK"
261+
stateless = "false"
262+
}
263+
264+
resource oci_core_network_security_group_security_rule export_NSG-ReplicationNET-rule_2 {
265+
description = "Allow traffic to VCN"
266+
destination = var.vcn_cidr
267+
destination_type = "CIDR_BLOCK"
268+
direction = "EGRESS"
269+
network_security_group_id = oci_core_network_security_group.export_ReplicationNET_nsg.id
270+
protocol = "all"
271+
source_type = ""
272+
stateless = "false"
273+
}
274+
275+
# --[ VLAN ProvisionNET ]--------------------------------------------------
276+
resource oci_core_network_security_group export_ProvisionNET_nsg {
277+
compartment_id = var.compartment_ocid
278+
display_name = "NSG ProvisionNet"
279+
vcn_id = oci_core_vcn.export_sddc_vcn.id
280+
}
281+
282+
resource oci_core_network_security_group_security_rule export_NSG-ProvisionNET-rule_1 {
283+
description = "Allow traffic from VCN"
284+
destination_type = ""
285+
direction = "INGRESS"
286+
network_security_group_id = oci_core_network_security_group.export_ProvisionNET_nsg.id
287+
protocol = "all"
288+
source = var.vcn_cidr
289+
source_type = "CIDR_BLOCK"
290+
stateless = "false"
291+
}
292+
293+
resource oci_core_network_security_group_security_rule export_NSG-ProvisionNET-rule_2 {
294+
description = "Allow traffic to VCN"
295+
destination = var.vcn_cidr
296+
destination_type = "CIDR_BLOCK"
297+
direction = "EGRESS"
298+
network_security_group_id = oci_core_network_security_group.export_ProvisionNET_nsg.id
299+
protocol = "all"
300+
source_type = ""
301+
stateless = "false"
302+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
## Terraform - Provisioning Multi host SDDC with single cluster
2+
3+
Date: February 2024
4+
5+
This is an example Terraform script to provision a multi host SDDC with a
6+
single cluster based on DenseIO shape, using VSAN for storage.
7+
8+
The terraform creates:
9+
- a VCN for deploying SDDC into
10+
- Needed subnet for ESXi servers
11+
- Needed VLANS for the VMware stack
12+
13+
The vSphere VLAN will be configured to allow egress traffic to internet via
14+
NAT Gateway. This is needed for provisioning to succeed. As internet access
15+
is needed to license registration with VMware.
16+
17+
more info:
18+
https://registry.terraform.io/providers/oracle/oci/latest/docs/resources/ocvp_sddc
19+
20+
# License
21+
Copyright (c) 2024 Oracle and/or its affiliates.
22+
Licensed under the Universal Permissive License (UPL), Version 1.0.
23+
See [LICENSE](https://github.com/oracle-devrel/technology-engineering/blob/main/LICENSE) for more details.

0 commit comments

Comments
 (0)