Skip to content

Commit

Permalink
fix formatting
Browse files Browse the repository at this point in the history
Signed-off-by: Paul Bastide <pbastide@us.ibm.com>
  • Loading branch information
prb112 committed Oct 23, 2023
1 parent cbf7917 commit 0299934
Showing 1 changed file with 33 additions and 33 deletions.
66 changes: 33 additions & 33 deletions modules/1_vpc_prepare/security_groups.tf
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,19 @@ data "ibm_is_security_groups" "sgs" {

locals {
sg_matches = [for x in data.ibm_is_security_groups.sgs.security_groups : x if endswith(x.name, "${var.vpc_name}-supp-sg")]
sg_exists = length(sg_matches) > 0 ? 0 : 1
sg_exists = length(sg_matches) > 0 ? 0 : 1
}

resource "ibm_is_security_group" "worker_vm_sg" {
count = local.sg_exists
count = local.sg_exists
name = "${var.vpc_name}-supp-sg"
vpc = data.ibm_is_vpc.vpc.id
resource_group = data.ibm_is_vpc.vpc.resource_group
}

# allow all outgoing network traffic
resource "ibm_is_security_group_rule" "worker_vm_sg_outgoing_all" {
count = local.sg_exists
count = local.sg_exists
group = ibm_is_security_group.worker_vm_sg[0].id
direction = "outbound"
remote = "0.0.0.0/0"
Expand All @@ -31,7 +31,7 @@ resource "ibm_is_security_group_rule" "worker_vm_sg_outgoing_all" {
# allow all incoming network traffic on port 8080
# This facilitates the ignition
resource "ibm_is_security_group_rule" "worker_ignition" {
count = local.sg_exists
count = local.sg_exists
group = ibm_is_security_group.worker_vm_sg[0].id
direction = "inbound"
remote = ibm_is_security_group.worker_vm_sg[0].id
Expand All @@ -43,7 +43,7 @@ resource "ibm_is_security_group_rule" "worker_ignition" {

# allow all incoming network traffic on port 22
resource "ibm_is_security_group_rule" "worker_vm_sg_ssh_all" {
count = local.sg_exists
count = local.sg_exists
group = ibm_is_security_group.worker_vm_sg[0].id
direction = "inbound"
remote = "0.0.0.0/0"
Expand All @@ -55,7 +55,7 @@ resource "ibm_is_security_group_rule" "worker_vm_sg_ssh_all" {

# allow all incoming network traffic on port 53
resource "ibm_is_security_group_rule" "worker_vm_sg_supp_all" {
count = local.sg_exists
count = local.sg_exists
group = ibm_is_security_group.worker_vm_sg[0].id
direction = "inbound"
remote = var.powervs_machine_cidr
Expand All @@ -68,7 +68,7 @@ resource "ibm_is_security_group_rule" "worker_vm_sg_supp_all" {
# Dev Note: the following are used by PowerVS and VPC VSIs.
# allow all incoming network traffic on port 2049
resource "ibm_is_security_group_rule" "nfs_1_vm_sg_ssh_all" {
count = local.sg_exists
count = local.sg_exists
group = ibm_is_security_group.worker_vm_sg[0].id
direction = "inbound"
remote = var.powervs_machine_cidr
Expand All @@ -80,7 +80,7 @@ resource "ibm_is_security_group_rule" "nfs_1_vm_sg_ssh_all" {

# allow all incoming network traffic on port 111
resource "ibm_is_security_group_rule" "nfs_2_vm_sg_ssh_all" {
count = local.sg_exists
count = local.sg_exists
group = ibm_is_security_group.worker_vm_sg[0].id
direction = "inbound"
remote = var.powervs_machine_cidr
Expand All @@ -92,7 +92,7 @@ resource "ibm_is_security_group_rule" "nfs_2_vm_sg_ssh_all" {

# allow all incoming network traffic on port 2049
resource "ibm_is_security_group_rule" "nfs_3_vm_sg_ssh_all" {
count = local.sg_exists
count = local.sg_exists
group = ibm_is_security_group.worker_vm_sg[0].id
direction = "inbound"
remote = var.powervs_machine_cidr
Expand All @@ -105,7 +105,7 @@ resource "ibm_is_security_group_rule" "nfs_3_vm_sg_ssh_all" {

# allow all incoming network traffic on port 111
resource "ibm_is_security_group_rule" "nfs_4_vm_sg_ssh_all" {
count = local.sg_exists
count = local.sg_exists
group = ibm_is_security_group.worker_vm_sg[0].id
direction = "inbound"
remote = var.powervs_machine_cidr
Expand All @@ -118,7 +118,7 @@ resource "ibm_is_security_group_rule" "nfs_4_vm_sg_ssh_all" {

# allow all incoming network traffic for ping
resource "ibm_is_security_group_rule" "worker_vm_sg_ping_all" {
count = local.sg_exists
count = local.sg_exists
group = ibm_is_security_group.worker_vm_sg[0].id
direction = "inbound"
remote = var.powervs_machine_cidr
Expand All @@ -129,7 +129,7 @@ resource "ibm_is_security_group_rule" "worker_vm_sg_ping_all" {
}

resource "ibm_is_security_group_rule" "control_plane_sg_mc" {
count = local.sg_exists
count = local.sg_exists
group = ibm_is_security_group.worker_vm_sg[0].id
direction = "inbound"
remote = var.powervs_machine_cidr
Expand All @@ -140,7 +140,7 @@ resource "ibm_is_security_group_rule" "control_plane_sg_mc" {
}

resource "ibm_is_security_group_rule" "control_plane_sg_api" {
count = local.sg_exists
count = local.sg_exists
group = ibm_is_security_group.worker_vm_sg[0].id
direction = "inbound"
remote = var.powervs_machine_cidr
Expand All @@ -157,7 +157,7 @@ resource "ibm_is_security_group_rule" "control_plane_sg_api" {
#TCP 22 192.168.200.0/24
#TCP - 9100 192.168.200.0/24
resource "ibm_is_security_group_rule" "cluster_wide_sg_6081" {
count = local.sg_exists
count = local.sg_exists
group = ibm_is_security_group.worker_vm_sg[0].id
direction = "inbound"
remote = var.powervs_machine_cidr
Expand All @@ -168,7 +168,7 @@ resource "ibm_is_security_group_rule" "cluster_wide_sg_6081" {
}

resource "ibm_is_security_group_rule" "cluster_wide_sg_any" {
count = local.sg_exists
count = local.sg_exists
group = ibm_is_security_group.worker_vm_sg[0].id
direction = "inbound"
remote = var.powervs_machine_cidr
Expand All @@ -177,7 +177,7 @@ resource "ibm_is_security_group_rule" "cluster_wide_sg_any" {
}

resource "ibm_is_security_group_rule" "cluster_wide_sg_4789" {
count = local.sg_exists
count = local.sg_exists
group = ibm_is_security_group.worker_vm_sg[0].id
direction = "inbound"
remote = var.powervs_machine_cidr
Expand All @@ -188,7 +188,7 @@ resource "ibm_is_security_group_rule" "cluster_wide_sg_4789" {
}

resource "ibm_is_security_group_rule" "cluster_wide_sg_ssh" {
count = local.sg_exists
count = local.sg_exists
group = ibm_is_security_group.worker_vm_sg[0].id
direction = "inbound"
remote = var.powervs_machine_cidr
Expand All @@ -199,7 +199,7 @@ resource "ibm_is_security_group_rule" "cluster_wide_sg_ssh" {
}

resource "ibm_is_security_group_rule" "cluster_wide_sg_9100" {
count = local.sg_exists
count = local.sg_exists
group = ibm_is_security_group.worker_vm_sg[0].id
direction = "inbound"
remote = var.powervs_machine_cidr
Expand All @@ -210,7 +210,7 @@ resource "ibm_is_security_group_rule" "cluster_wide_sg_9100" {
}

resource "ibm_is_security_group_rule" "cluster_wide_sg_9537" {
count = local.sg_exists
count = local.sg_exists
group = ibm_is_security_group.worker_vm_sg[0].id
direction = "inbound"
remote = var.powervs_machine_cidr
Expand All @@ -224,7 +224,7 @@ resource "ibm_is_security_group_rule" "cluster_wide_sg_9537" {
#TCP 2379-2380 192.168.200.0/24
#TCP 10257-10259 192.168.200.0/24
resource "ibm_is_security_group_rule" "cp_internal_sg_r1" {
count = local.sg_exists
count = local.sg_exists
group = ibm_is_security_group.worker_vm_sg[0].id
direction = "inbound"
remote = var.powervs_machine_cidr
Expand All @@ -235,7 +235,7 @@ resource "ibm_is_security_group_rule" "cp_internal_sg_r1" {
}

resource "ibm_is_security_group_rule" "cp_internal_sg_r2" {
count = local.sg_exists
count = local.sg_exists
group = ibm_is_security_group.worker_vm_sg[0].id
direction = "inbound"
remote = var.powervs_machine_cidr
Expand All @@ -252,7 +252,7 @@ resource "ibm_is_security_group_rule" "cp_internal_sg_r2" {
# TCP (Out) 80 192.168.200.0/24
# TCP (Out) 443 192.168.200.0/24
resource "ibm_is_security_group_rule" "kube_api_lb_sg_mc" {
count = local.sg_exists
count = local.sg_exists
group = ibm_is_security_group.worker_vm_sg[0].id
direction = "inbound"
remote = var.powervs_machine_cidr
Expand All @@ -263,7 +263,7 @@ resource "ibm_is_security_group_rule" "kube_api_lb_sg_mc" {
}

resource "ibm_is_security_group_rule" "kube_api_lb_sg_mc_out" {
count = local.sg_exists
count = local.sg_exists
group = ibm_is_security_group.worker_vm_sg[0].id
direction = "outbound"
remote = var.powervs_machine_cidr
Expand All @@ -274,7 +274,7 @@ resource "ibm_is_security_group_rule" "kube_api_lb_sg_mc_out" {
}

resource "ibm_is_security_group_rule" "kube_api_lb_sg_api_out" {
count = local.sg_exists
count = local.sg_exists
group = ibm_is_security_group.worker_vm_sg[0].id
direction = "outbound"
remote = var.powervs_machine_cidr
Expand All @@ -285,7 +285,7 @@ resource "ibm_is_security_group_rule" "kube_api_lb_sg_api_out" {
}

resource "ibm_is_security_group_rule" "kube_api_lb_sg_http_out" {
count = local.sg_exists
count = local.sg_exists
group = ibm_is_security_group.worker_vm_sg[0].id
direction = "outbound"
remote = var.powervs_machine_cidr
Expand All @@ -296,7 +296,7 @@ resource "ibm_is_security_group_rule" "kube_api_lb_sg_http_out" {
}

resource "ibm_is_security_group_rule" "kube_api_lb_sg_https_out" {
count = local.sg_exists
count = local.sg_exists
group = ibm_is_security_group.worker_vm_sg[0].id
direction = "outbound"
remote = var.powervs_machine_cidr
Expand All @@ -315,7 +315,7 @@ resource "ibm_is_security_group_rule" "kube_api_lb_sg_https_out" {
# TCP (IN) 10250 192.168.200.0/24
# Dev Note: originally used 32767 and it's too low. Changed to 65000
resource "ibm_is_security_group_rule" "openshift_net_sg_r1_in_tcp" {
count = local.sg_exists
count = local.sg_exists
group = ibm_is_security_group.worker_vm_sg[0].id
direction = "inbound"
remote = var.powervs_machine_cidr
Expand All @@ -326,7 +326,7 @@ resource "ibm_is_security_group_rule" "openshift_net_sg_r1_in_tcp" {
}

resource "ibm_is_security_group_rule" "openshift_net_sg_r1_in_udp" {
count = local.sg_exists
count = local.sg_exists
group = ibm_is_security_group.worker_vm_sg[0].id
direction = "inbound"
remote = var.powervs_machine_cidr
Expand All @@ -337,7 +337,7 @@ resource "ibm_is_security_group_rule" "openshift_net_sg_r1_in_udp" {
}

resource "ibm_is_security_group_rule" "openshift_net_sg_500" {
count = local.sg_exists
count = local.sg_exists
group = ibm_is_security_group.worker_vm_sg[0].id
direction = "inbound"
remote = var.powervs_machine_cidr
Expand All @@ -348,7 +348,7 @@ resource "ibm_is_security_group_rule" "openshift_net_sg_500" {
}

resource "ibm_is_security_group_rule" "openshift_net_sg_r2_in_tcp" {
count = local.sg_exists
count = local.sg_exists
group = ibm_is_security_group.worker_vm_sg[0].id
direction = "inbound"
remote = var.powervs_machine_cidr
Expand All @@ -359,7 +359,7 @@ resource "ibm_is_security_group_rule" "openshift_net_sg_r2_in_tcp" {
}

resource "ibm_is_security_group_rule" "openshift_net_sg_r2_in_udp" {
count = local.sg_exists
count = local.sg_exists
group = ibm_is_security_group.worker_vm_sg[0].id
direction = "inbound"
remote = var.powervs_machine_cidr
Expand All @@ -370,7 +370,7 @@ resource "ibm_is_security_group_rule" "openshift_net_sg_r2_in_udp" {
}

resource "ibm_is_security_group_rule" "openshift_net_sg_10250_out" {
count = local.sg_exists
count = local.sg_exists
group = ibm_is_security_group.worker_vm_sg[0].id
direction = "inbound"
remote = var.powervs_machine_cidr
Expand All @@ -381,7 +381,7 @@ resource "ibm_is_security_group_rule" "openshift_net_sg_10250_out" {
}

resource "ibm_is_security_group_rule" "openshift_net_sg_4500" {
count = local.sg_exists
count = local.sg_exists
group = ibm_is_security_group.worker_vm_sg[0].id
direction = "inbound"
remote = var.powervs_machine_cidr
Expand Down

0 comments on commit 0299934

Please sign in to comment.