52 lines
1.8 KiB
HCL
Executable File
52 lines
1.8 KiB
HCL
Executable File
resource "oci_core_network_security_group" "memcached-servers-nsg" {
|
|
compartment_id = var.ocid_compartment_networking
|
|
display_name = "memcached-servers-nsg"
|
|
vcn_id = var.ocid_vcn_3_tier
|
|
}
|
|
#--------------------------------------------------------------------------------------------------------------------------------------------
|
|
resource "oci_core_network_security_group_security_rule" "nsg_memcached_ingress_rule_01" {
|
|
network_security_group_id = oci_core_network_security_group.memcached-servers-nsg.id
|
|
description = "Ingress Memcached from app-subnet."
|
|
source = var.cidr_subnet_app
|
|
source_type = "CIDR_BLOCK"
|
|
direction = "INGRESS"
|
|
protocol = "6"
|
|
tcp_options {
|
|
destination_port_range {
|
|
max = 11211
|
|
min = 11211
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
#--------------------------------------------------------------------------------------------------------------------------------------------
|
|
resource "oci_core_network_security_group_security_rule" "nsg_memcached_egress_rule_01" {
|
|
network_security_group_id = oci_core_network_security_group.memcached-servers-nsg.id
|
|
description = "Egress to OSN"
|
|
destination = lookup(data.oci_core_services.all_services.services[1], "cidr_block")
|
|
destination_type = "SERVICE_CIDR_BLOCK"
|
|
direction = "EGRESS"
|
|
protocol = "6"
|
|
tcp_options {
|
|
destination_port_range {
|
|
max = 443
|
|
min = 443
|
|
}
|
|
}
|
|
}
|
|
|
|
resource "oci_core_network_security_group_security_rule" "nsg_memcached_egress_rule_02" {
|
|
network_security_group_id = oci_core_network_security_group.memcached-servers-nsg.id
|
|
description = "Egress to Internet port TCP/443"
|
|
destination = var.cidr_anywhere
|
|
destination_type = "CIDR_BLOCK"
|
|
direction = "EGRESS"
|
|
protocol = "6"
|
|
tcp_options {
|
|
destination_port_range {
|
|
max = 443
|
|
min = 443
|
|
}
|
|
}
|
|
} |