-
Notifications
You must be signed in to change notification settings - Fork 47
Expand file tree
/
Copy pathsubnets.tf
More file actions
96 lines (86 loc) · 2.49 KB
/
subnets.tf
File metadata and controls
96 lines (86 loc) · 2.49 KB
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
resource "oci_core_subnet" "vcn_private_subnet" {
compartment_id = var.compartment_id
vcn_id = module.vcn.vcn_id
cidr_block = "10.0.1.0/24"
route_table_id = module.vcn.nat_route_id
security_list_ids = [
oci_core_security_list.private_subnet_sl.id,
oci_core_security_list.nlb_private_subnet_sl.id
]
display_name = "k8s-private-subnet"
prohibit_public_ip_on_vnic = true
}
resource "oci_core_subnet" "vcn_public_subnet" {
compartment_id = var.compartment_id
vcn_id = module.vcn.vcn_id
cidr_block = "10.0.0.0/24"
route_table_id = module.vcn.ig_route_id
security_list_ids = [oci_core_security_list.public_subnet_sl.id]
display_name = "k8s-public-subnet"
}
resource "oci_core_security_list" "private_subnet_sl" {
compartment_id = var.compartment_id
vcn_id = module.vcn.vcn_id
display_name = "k8s-private-subnet-sl"
# egress everywhere
egress_security_rules {
stateless = false
destination = "0.0.0.0/0"
destination_type = "CIDR_BLOCK"
protocol = "all"
}
# ingress only from our cidr
ingress_security_rules {
stateless = false
source = "10.0.0.0/16"
source_type = "CIDR_BLOCK"
protocol = "all"
}
}
resource "oci_core_security_list" "public_subnet_sl" {
compartment_id = var.compartment_id
vcn_id = module.vcn.vcn_id
display_name = "k8s-public-subnet-sl"
# egress everywhere
egress_security_rules {
stateless = false
destination = "0.0.0.0/0"
destination_type = "CIDR_BLOCK"
protocol = "all"
}
# ingres only our cidr
ingress_security_rules {
stateless = false
source = "10.0.0.0/16"
source_type = "CIDR_BLOCK"
protocol = "all"
}
# ingress from internet on k8s-api
ingress_security_rules {
stateless = false
source = "0.0.0.0/0"
source_type = "CIDR_BLOCK"
protocol = "6"
tcp_options {
min = 6443
max = 6443
}
}
}
# for network load balancer
# https://docs.oracle.com/en-us/iaas/Content/ContEng/Tasks/contengcreatingnetworkloadbalancers.htm
resource "oci_core_security_list" "nlb_private_subnet_sl" {
compartment_id = var.compartment_id
vcn_id = module.vcn.vcn_id
display_name = "nlb-k8s-private-subnet-sl"
ingress_security_rules {
stateless = false
source = "0.0.0.0/0"
source_type = "CIDR_BLOCK"
protocol = "6"
tcp_options {
min = 30000
max = 32767
}
}
}