-
Notifications
You must be signed in to change notification settings - Fork 3
/
nsg.tf
59 lines (52 loc) · 2.18 KB
/
nsg.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
resource "oci_core_network_security_group" "FoggyKitchenWebSecurityGroup" {
compartment_id = oci_identity_compartment.FoggyKitchenCompartment.id
display_name = "FoggyKitchenWebSecurityGroup"
vcn_id = oci_core_virtual_network.FoggyKitchenVCN.id
}
resource "oci_core_network_security_group" "FoggyKitchenSSHSecurityGroup" {
compartment_id = oci_identity_compartment.FoggyKitchenCompartment.id
display_name = "FoggyKitchenSSHSecurityGroup"
vcn_id = oci_core_virtual_network.FoggyKitchenVCN.id
}
resource "oci_core_network_security_group_security_rule" "FoggyKitchenWebSecurityEgressGroupRule" {
network_security_group_id = oci_core_network_security_group.FoggyKitchenWebSecurityGroup.id
direction = "EGRESS"
protocol = "6"
destination = "0.0.0.0/0"
destination_type = "CIDR_BLOCK"
}
resource "oci_core_network_security_group_security_rule" "FoggyKitchenWebSecurityIngressGroupRules" {
for_each = toset(var.webservice_ports)
network_security_group_id = oci_core_network_security_group.FoggyKitchenWebSecurityGroup.id
direction = "INGRESS"
protocol = "6"
source = "0.0.0.0/0"
source_type = "CIDR_BLOCK"
tcp_options {
destination_port_range {
max = each.value
min = each.value
}
}
}
resource "oci_core_network_security_group_security_rule" "FoggyKitchenSSHSecurityEgressGroupRule" {
network_security_group_id = oci_core_network_security_group.FoggyKitchenSSHSecurityGroup.id
direction = "EGRESS"
protocol = "6"
destination = "0.0.0.0/0"
destination_type = "CIDR_BLOCK"
}
resource "oci_core_network_security_group_security_rule" "FoggyKitchenSSHSecurityIngressGroupRules" {
for_each = toset(var.bastion_ports)
network_security_group_id = oci_core_network_security_group.FoggyKitchenSSHSecurityGroup.id
direction = "INGRESS"
protocol = "6"
source = "0.0.0.0/0"
source_type = "CIDR_BLOCK"
tcp_options {
destination_port_range {
max = each.value
min = each.value
}
}
}