mirror of
https://github.com/kittywitch/nixfiles.git
synced 2026-02-09 12:29:19 -08:00
feat(oci private network): add default route table and security list
management
This commit is contained in:
parent
07cbaca206
commit
fea4a43dcc
6 changed files with 47 additions and 16 deletions
13
tf/oci_common_private_network/default_route_table.tf
Normal file
13
tf/oci_common_private_network/default_route_table.tf
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
|
||||||
|
resource "oci_core_default_route_table" "this" {
|
||||||
|
manage_default_resource_id = oci_core_vcn.this.default_route_table_id
|
||||||
|
|
||||||
|
display_name = oci_core_vcn.this.display_name
|
||||||
|
|
||||||
|
route_rules {
|
||||||
|
network_entity_id = oci_core_internet_gateway.this.id
|
||||||
|
|
||||||
|
description = "Default route"
|
||||||
|
destination = "0.0.0.0/0"
|
||||||
|
}
|
||||||
|
}
|
||||||
26
tf/oci_common_private_network/default_security_list.tf
Normal file
26
tf/oci_common_private_network/default_security_list.tf
Normal file
|
|
@ -0,0 +1,26 @@
|
||||||
|
resource "oci_core_default_security_list" "this" {
|
||||||
|
manage_default_resource_id = local.vcn.default_security_list_id
|
||||||
|
|
||||||
|
dynamic "ingress_security_rules" {
|
||||||
|
for_each = [22, 80, 443]
|
||||||
|
iterator = port
|
||||||
|
content {
|
||||||
|
protocol = local.protocol_number.tcp
|
||||||
|
source = "0.0.0.0/0"
|
||||||
|
|
||||||
|
description = "SSH and HTTPS traffic from any origin"
|
||||||
|
|
||||||
|
tcp_options {
|
||||||
|
max = port.value
|
||||||
|
min = port.value
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
egress_security_rules {
|
||||||
|
destination = "0.0.0.0/0"
|
||||||
|
protocol = "all"
|
||||||
|
|
||||||
|
description = "All traffic to any destination"
|
||||||
|
}
|
||||||
|
}
|
||||||
8
tf/oci_common_private_network/firewalling_locals.tf
Normal file
8
tf/oci_common_private_network/firewalling_locals.tf
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
locals {
|
||||||
|
protocol_number = {
|
||||||
|
icmp = 1
|
||||||
|
icmpv6 = 58
|
||||||
|
tcp = 6
|
||||||
|
udp = 17
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -5,15 +5,6 @@ resource "oci_core_network_security_group" "this" {
|
||||||
display_name = oci_core_vcn.this.display_name
|
display_name = oci_core_vcn.this.display_name
|
||||||
}
|
}
|
||||||
|
|
||||||
locals {
|
|
||||||
protocol_number = {
|
|
||||||
icmp = 1
|
|
||||||
icmpv6 = 58
|
|
||||||
tcp = 6
|
|
||||||
udp = 17
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
resource "oci_core_network_security_group_security_rule" "icmp_in" {
|
resource "oci_core_network_security_group_security_rule" "icmp_in" {
|
||||||
direction = "INGRESS"
|
direction = "INGRESS"
|
||||||
network_security_group_id = oci_core_network_security_group.this.id
|
network_security_group_id = oci_core_network_security_group.this.id
|
||||||
|
|
@ -1,11 +1,4 @@
|
||||||
locals {
|
locals {
|
||||||
protocol_number = {
|
|
||||||
icmp = 1
|
|
||||||
icmpv6 = 58
|
|
||||||
tcp = 6
|
|
||||||
udp = 17
|
|
||||||
}
|
|
||||||
|
|
||||||
shapes = {
|
shapes = {
|
||||||
flex : "VM.Standard.A1.Flex",
|
flex : "VM.Standard.A1.Flex",
|
||||||
micro : "VM.Standard.E2.1.Micro",
|
micro : "VM.Standard.E2.1.Micro",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue