diff --git a/terraform-modules/aws/vpc/main.tf b/terraform-modules/aws/vpc/main.tf index 7500b2d64..957faf030 100644 --- a/terraform-modules/aws/vpc/main.tf +++ b/terraform-modules/aws/vpc/main.tf @@ -38,6 +38,14 @@ module "vpc" { "kubernetes.io/role/internal-elb" = "1" "ops_purpose" = "Overloaded for k8s worker usage" } - + tags = var.tags + + #Default Security Group Management (Default: secure) + manage_default_security_group = var.manage_default_security_group + default_security_group_name = var.default_security_group_name + default_security_group_egress = var.default_security_group_egress + default_security_group_ingress = var.default_security_group_ingress + default_security_group_tags = var.default_security_group_tags + } diff --git a/terraform-modules/aws/vpc/variables.tf b/terraform-modules/aws/vpc/variables.tf index 6680037b0..d888a5370 100644 --- a/terraform-modules/aws/vpc/variables.tf +++ b/terraform-modules/aws/vpc/variables.tf @@ -74,3 +74,77 @@ variable "external_nat_ip_ids" { type = list(string) default = [] } + +#Default Security Group Management (Default: secure) +variable "manage_default_security_group" { + description = "Should be true to adopt and manage default security group" + type = bool + default = true +} + +variable "default_security_group_name" { + description = "Name to be used on the default security group " + type = string + default = "default" +} + +variable "default_security_group_egress" { + description = "List of maps of egress rules to set on the default security group" + type = list(map(string)) + default = [ + { + cidr_blocks = "0.0.0.0/0" + description = "Allow all" + from_port = 0 + protocol = "-1" + self = false + to_port = 0 + } + ] +} + +variable "default_security_group_ingress" { + description = "List of maps of ingress rules to set on the default security group " + type = list(map(string)) + default = [ + { + cidr_blocks = "10.0.0.0/8" + description = "rfc1918: Private Address Space" + from_port = 0 + protocol = "-1" + self = false + to_port = 0 + }, + { + cidr_blocks = "172.16.0.0/12" + description = "rfc1918: Private Address Space" + from_port = 0 + protocol = "-1" + self = false + to_port = 0 + }, + { + cidr_blocks = "192.168.0.0/16" + description = "rfc1918: Private Address Space" + from_port = 0 + protocol = "-1" + self = false + to_port = 0 + }, + { + cidr_blocks = "100.64.0.0/10" + description = "rfc6598: Private Address Space" + from_port = 0 + protocol = "-1" + self = false + to_port = 0 + } + ] +} + +variable "default_security_group_tags" { + description = "Additional tags for the default security group " + type = map(any) + default = {} +} +