Skip to content

Commit

Permalink
added new variables to ssh and snmp security groups
Browse files Browse the repository at this point in the history
  • Loading branch information
zachreborn committed Jul 21, 2024
1 parent f71837e commit 7165856
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 21 deletions.
42 changes: 28 additions & 14 deletions modules/aws/vendor/velocloud/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -18,27 +18,41 @@ data "aws_region" "current" {}
# Security Groups
############################################

resource "aws_security_group" "velocloud_sdwan_mgmt_sg" {
resource "aws_security_group" "sdwan_mgmt_sg" {
name = var.wan_mgmt_sg_name
description = "Security group applied to the VeloCloud SDWAN instance WAN and MGMT NICs for VeloCloud communication"
vpc_id = var.vpc_id

egress {
description = "HTTPS Tunnel"
from_port = 443
to_port = 443
ingress {
description = "SSH access for support"
from_port = 22
to_port = 22
protocol = "TCP"
# CATO Cloud requires this port to be open to the internet
#tfsec:ignore:aws-ec2-no-public-egress-sgr
cidr_blocks = var.ssh_mgmt_access_cidr_blocks
}

ingress {
description = "SNMP access for management"
from_port = 161
to_port = 161
protocol = "UDP"
cidr_blocks = var.snmp_mgmt_access_cidr_blocks
}

ingress {
description = "VMware Multipath Protocol"
from_port = 2426
to_port = 2426
protocol = "UDP"
cidr_blocks = ["0.0.0.0/0"]
}

egress {
description = "HTTPS Tunnel"
from_port = 443
to_port = 443
protocol = "UDP"
# CATO Cloud requires this port to be open to the internet
description = "All traffic"
from_port = 0
to_port = 0
protocol = "-1"
# VeloCloud SDWAN requires this port to be open to the internet
#tfsec:ignore:aws-ec2-no-public-egress-sgr
cidr_blocks = ["0.0.0.0/0"]
}
Expand Down Expand Up @@ -96,7 +110,7 @@ resource "aws_network_interface" "mgmt_nic" {
count = var.number
description = var.mgmt_nic_description
private_ips = var.mgmt_ips
security_groups = [aws_security_group.cato_wan_mgmt_sg.id]
security_groups = [aws_security_group.sdwan_mgmt_sg.id]
subnet_id = element(var.mgmt_subnet_id, count.index)
tags = merge(var.tags, ({ "Name" = format("%s%d_mgmt", var.instance_name_prefix, count.index + 1) }))
}
Expand All @@ -106,7 +120,7 @@ resource "aws_network_interface" "public_nic" {
count = var.number
description = var.public_nic_description
private_ips = [element(var.public_ips, count.index)]
security_groups = [aws_security_group.cato_wan_mgmt_sg.id]
security_groups = [aws_security_group.sdwan_mgmt_sg.id]
subnet_id = element(var.public_subnet_id, count.index)
tags = merge(var.tags, ({ "Name" = format("%s%d_public", var.instance_name_prefix, count.index + 1) }))

Expand Down
26 changes: 19 additions & 7 deletions modules/aws/vendor/velocloud/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,27 @@
# Security Groups
############################################

variable "wan_mgmt_sg_name" {
variable "lan_sg_name" {
description = "(Optional, Forces new resource) Name of the security group. If omitted, Terraform will assign a random, unique name."
default = "velocloud_wan_mgmt_sg"
default = "velocloud_lan_sg"
type = string
}

variable "vpc_id" {
description = "(Required, Forces new resource) VPC ID. Defaults to the region's default VPC."
type = string
variable "snmp_mgmt_access_cidr_blocks" {
description = "(Optional) List of CIDR blocks allowed to SNMP into the VeloCloud instance."
default = []
type = list(string)
}

variable "lan_sg_name" {
variable "ssh_mgmt_access_cidr_blocks" {
description = "(Optional) List of CIDR blocks allowed to SSH into the VeloCloud instance."
default = []
type = list(string)
}

variable "wan_mgmt_sg_name" {
description = "(Optional, Forces new resource) Name of the security group. If omitted, Terraform will assign a random, unique name."
default = "velocloud_lan_sg"
default = "velocloud_wan_mgmt_sg"
type = string
}

Expand All @@ -25,6 +32,11 @@ variable "velocloud_lan_cidr_blocks" {
default = null
}

variable "vpc_id" {
description = "(Required, Forces new resource) VPC ID. Defaults to the region's default VPC."
type = string
}

############################################
# ENI
############################################
Expand Down

0 comments on commit 7165856

Please sign in to comment.