mirror of
https://github.com/vcscsvcscs/OCI-Kubernetes-cluster-with-traefik.git
synced 2025-08-13 22:39:06 +02:00
Add oci managed terraform + create snet module
This commit is contained in:
0
oci-managed/snet/output.tf
Normal file
0
oci-managed/snet/output.tf
Normal file
108
oci-managed/snet/security_rules.tf
Normal file
108
oci-managed/snet/security_rules.tf
Normal file
@@ -0,0 +1,108 @@
|
||||
resource "oci_core_security_list" "private_subnet_sl" {
|
||||
compartment_id = var.compartment_ocid
|
||||
vcn_id = var.vcn_id
|
||||
|
||||
display_name = "${var.cluster_name}-${var.environment}-private-subnet-sl"
|
||||
|
||||
egress_security_rules {
|
||||
stateless = false
|
||||
destination = "0.0.0.0/0"
|
||||
destination_type = "CIDR_BLOCK"
|
||||
protocol = "all"
|
||||
}
|
||||
|
||||
ingress_security_rules {
|
||||
stateless = false
|
||||
source = "10.0.0.0/16"
|
||||
source_type = "CIDR_BLOCK"
|
||||
protocol = "all"
|
||||
}
|
||||
|
||||
ingress_security_rules {
|
||||
stateless = false
|
||||
source = "10.0.0.0/24"
|
||||
source_type = "CIDR_BLOCK"
|
||||
protocol = "6"
|
||||
tcp_options {
|
||||
min = 10256
|
||||
max = 10256
|
||||
}
|
||||
}
|
||||
|
||||
ingress_security_rules {
|
||||
stateless = false
|
||||
source = "10.0.0.0/24"
|
||||
source_type = "CIDR_BLOCK"
|
||||
protocol = "6"
|
||||
tcp_options {
|
||||
min = 31600
|
||||
max = 31600
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
resource "oci_core_security_list" "public_subnet_sl" {
|
||||
compartment_id = var.compartment_ocid
|
||||
vcn_id = var.vcn_id
|
||||
|
||||
display_name = "${var.cluster_name}-${var.environment}-public-subnet-sl"
|
||||
|
||||
egress_security_rules {
|
||||
stateless = false
|
||||
destination = "0.0.0.0/0"
|
||||
destination_type = "CIDR_BLOCK"
|
||||
protocol = "all"
|
||||
}
|
||||
|
||||
egress_security_rules {
|
||||
stateless = false
|
||||
destination = "10.0.1.0/24"
|
||||
destination_type = "CIDR_BLOCK"
|
||||
protocol = "6"
|
||||
tcp_options {
|
||||
min = 31600
|
||||
max = 31600
|
||||
}
|
||||
}
|
||||
|
||||
egress_security_rules {
|
||||
stateless = false
|
||||
destination = "10.0.1.0/24"
|
||||
destination_type = "CIDR_BLOCK"
|
||||
protocol = "6"
|
||||
tcp_options {
|
||||
min = 10256
|
||||
max = 10256
|
||||
}
|
||||
}
|
||||
|
||||
ingress_security_rules {
|
||||
protocol = "6"
|
||||
source = "0.0.0.0/0"
|
||||
source_type = "CIDR_BLOCK"
|
||||
stateless = false
|
||||
|
||||
tcp_options {
|
||||
max = 80
|
||||
min = 80
|
||||
}
|
||||
}
|
||||
|
||||
ingress_security_rules {
|
||||
stateless = false
|
||||
source = "10.0.0.0/16"
|
||||
source_type = "CIDR_BLOCK"
|
||||
protocol = "all"
|
||||
}
|
||||
|
||||
ingress_security_rules {
|
||||
stateless = false
|
||||
source = "0.0.0.0/0"
|
||||
source_type = "CIDR_BLOCK"
|
||||
protocol = "6"
|
||||
tcp_options {
|
||||
min = 6443
|
||||
max = 6443
|
||||
}
|
||||
}
|
||||
}
|
20
oci-managed/snet/subnets.tf
Normal file
20
oci-managed/snet/subnets.tf
Normal file
@@ -0,0 +1,20 @@
|
||||
resource "oci_core_subnet" "vcn_private_subnet" {
|
||||
compartment_id = var.compartment_ocid
|
||||
vcn_id = var.vcn_id
|
||||
cidr_block = "10.0.1.0/24"
|
||||
|
||||
route_table_id = var.vcn_nat_route_id
|
||||
security_list_ids = [oci_core_security_list.private_subnet_sl.id]
|
||||
display_name = "${var.cluster_name}-${var.environment}-private-subnet"
|
||||
prohibit_public_ip_on_vnic = true
|
||||
}
|
||||
|
||||
resource "oci_core_subnet" "vcn_public_subnet" {
|
||||
compartment_id = var.compartment_ocid
|
||||
vcn_id = var.vcn_id
|
||||
cidr_block = "10.0.0.0/24"
|
||||
|
||||
route_table_id = var.vcn_ig_route_id
|
||||
security_list_ids = [oci_core_security_list.public_subnet_sl.id]
|
||||
display_name = "${var.cluster_name}-${var.environment}-public-subnet"
|
||||
}
|
16
oci-managed/snet/variables.tf
Normal file
16
oci-managed/snet/variables.tf
Normal file
@@ -0,0 +1,16 @@
|
||||
variable "compartment_ocid" {}
|
||||
variable "vcn_id" {}
|
||||
variable "vcn_nat_route_id" {
|
||||
type = string
|
||||
}
|
||||
variable "vcn_ig_route_id" {
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "cluster_name" {
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "environment" {
|
||||
default = "prod"
|
||||
}
|
Reference in New Issue
Block a user