-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsubnets.tf
75 lines (57 loc) · 2.36 KB
/
subnets.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
# Public resources
resource "oci_core_route_table" "cluster_rt_public" {
compartment_id = var.compartment_ocid
vcn_id = oci_core_vcn.cluster.id
display_name = "rt-public-${var.cluster_name}"
route_rules {
description = "traffic to/from internet"
destination = "0.0.0.0/0"
destination_type = "CIDR_BLOCK"
network_entity_id = oci_core_internet_gateway.cluster.id
}
depends_on = [oci_core_vcn.cluster, oci_core_internet_gateway.cluster]
}
resource "oci_core_subnet" "cluster_public_subnet" {
cidr_block = "172.16.10.0/24"
compartment_id = var.compartment_ocid
dhcp_options_id = oci_core_vcn.cluster.default_dhcp_options_id
display_name = "public-subnet-regional-${var.cluster_name}"
dns_label = "publicsubnet"
prohibit_internet_ingress = "false"
prohibit_public_ip_on_vnic = "false"
route_table_id = oci_core_route_table.cluster_rt_public.id
vcn_id = oci_core_vcn.cluster.id
depends_on = [oci_core_vcn.cluster, oci_core_route_table.cluster_rt_public]
}
# Private resources
resource "oci_core_route_table" "cluster_rt_private" {
compartment_id = var.compartment_ocid
vcn_id = oci_core_vcn.cluster.id
display_name = "rt-private-${var.cluster_name}"
route_rules {
description = "traffic to the internet"
destination = "0.0.0.0/0"
destination_type = "CIDR_BLOCK"
network_entity_id = oci_core_nat_gateway.cluster.id
}
route_rules {
description = "traffic to OCI services"
destination = "all-gru-services-in-oracle-services-network"
destination_type = "SERVICE_CIDR_BLOCK"
network_entity_id = oci_core_service_gateway.cluster.id
#route_type = <<Optional value not found in discovery>>
}
depends_on = [oci_core_vcn.cluster, oci_core_service_gateway.cluster]
}
resource "oci_core_subnet" "cluster_private_subnet" {
cidr_block = "172.16.20.0/24"
compartment_id = var.compartment_ocid
dhcp_options_id = oci_core_vcn.cluster.default_dhcp_options_id
display_name = "private-subnet-regional-${var.cluster_name}"
dns_label = "privatesubnet"
prohibit_internet_ingress = "true"
prohibit_public_ip_on_vnic = "true"
route_table_id = oci_core_route_table.cluster_rt_private.id
vcn_id = oci_core_vcn.cluster.id
depends_on = [oci_core_vcn.cluster, oci_core_route_table.cluster_rt_private]
}