forked from oracle-quickstart/oci-arch-tomcat-mds
-
Notifications
You must be signed in to change notification settings - Fork 0
/
nsg.tf
123 lines (102 loc) · 4.03 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
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
## Copyright © 2021, Oracle and/or its affiliates.
## All rights reserved. The Universal Permissive License (UPL), Version 1.0 as shown at http://oss.oracle.com/licenses/upl
# SSHSecurityGroup
resource "oci_core_network_security_group" "SSHSecurityGroup" {
compartment_id = var.compartment_ocid
vcn_id = oci_core_vcn.vcn01.id
display_name = "Bastion_NSG"
defined_tags = { "${oci_identity_tag_namespace.ArchitectureCenterTagNamespace.name}.${oci_identity_tag.ArchitectureCenterTag.name}" = var.release }
}
# SSHSecurityGroup Rules - EGRESS
resource "oci_core_network_security_group_security_rule" "SSHSecurityEgressGroupRule" {
network_security_group_id = oci_core_network_security_group.SSHSecurityGroup.id
direction = "EGRESS"
protocol = "6"
destination = "0.0.0.0/0"
destination_type = "CIDR_BLOCK"
}
# SSHSecurityGroup Rules - INGRES
resource "oci_core_network_security_group_security_rule" "SSHSecurityIngressGroupRules" {
network_security_group_id = oci_core_network_security_group.SSHSecurityGroup.id
direction = "INGRESS"
protocol = "6"
source = "0.0.0.0/0"
source_type = "CIDR_BLOCK"
tcp_options {
destination_port_range {
max = 22
min = 22
}
}
}
# LBSecurityGroup
resource "oci_core_network_security_group" "LBSecurityGroup" {
compartment_id = var.compartment_ocid
vcn_id = oci_core_vcn.vcn01.id
display_name = "LB_NSG"
defined_tags = { "${oci_identity_tag_namespace.ArchitectureCenterTagNamespace.name}.${oci_identity_tag.ArchitectureCenterTag.name}" = var.release }
}
# LBSecurityGroup Rules - EGRESS
resource "oci_core_network_security_group_security_rule" "LBSecurityEgressInternetGroupRule" {
network_security_group_id = oci_core_network_security_group.LBSecurityGroup.id
direction = "EGRESS"
protocol = "6"
destination = "0.0.0.0/0"
destination_type = "CIDR_BLOCK"
}
# LBSecurityGroup Rules - INGRESS
resource "oci_core_network_security_group_security_rule" "LBSecurityIngressGroupRules_TCP80" {
network_security_group_id = oci_core_network_security_group.LBSecurityGroup.id
direction = "INGRESS"
protocol = "6"
source = "0.0.0.0/0"
source_type = "CIDR_BLOCK"
tcp_options {
destination_port_range {
max = 80
min = 80
}
}
}
resource "oci_core_network_security_group_security_rule" "LBSecurityIngressGroupRules_TCP443" {
network_security_group_id = oci_core_network_security_group.LBSecurityGroup.id
direction = "INGRESS"
protocol = "6"
source = "0.0.0.0/0"
source_type = "CIDR_BLOCK"
tcp_options {
destination_port_range {
max = 443
min = 443
}
}
}
# APPSecurityGroup
resource "oci_core_network_security_group" "APPSecurityGroup" {
compartment_id = var.compartment_ocid
vcn_id = oci_core_vcn.vcn01.id
display_name = "APP_NSG"
defined_tags = { "${oci_identity_tag_namespace.ArchitectureCenterTagNamespace.name}.${oci_identity_tag.ArchitectureCenterTag.name}" = var.release }
}
# EGRESS Rules - APPSecurityGroup
resource "oci_core_network_security_group_security_rule" "APPSecurityEgressGroupRules" {
network_security_group_id = oci_core_network_security_group.APPSecurityGroup.id
direction = "EGRESS"
protocol = "6"
destination = "0.0.0.0/0"
destination_type = "CIDR_BLOCK"
}
# INGRESS Rules - APPSecurityGroup
resource "oci_core_network_security_group_security_rule" "APPSecurityIngressGroupRules" {
network_security_group_id = oci_core_network_security_group.APPSecurityGroup.id
direction = "INGRESS"
protocol = "6"
source = "0.0.0.0/0"
source_type = "CIDR_BLOCK"
tcp_options {
destination_port_range {
max = 8080
min = 8080
}
}
}