diff --git a/rds-mssql/main.tf b/rds-mssql/main.tf index 77c9805..1301722 100644 --- a/rds-mssql/main.tf +++ b/rds-mssql/main.tf @@ -11,6 +11,7 @@ * * # name = "m-rds-mssql" * vpc_id = var.vpc_id +* vpc_full_name = "vpc1-services" * # Name, CostAllocation, and Environment are pre-set * # tags = { } * } @@ -19,42 +20,42 @@ locals { description = "module: MS SQL Server Common Ports" - name = var.name + name = var.name ports = [ - [ 1433, 1433, "tcp" ], - [ 5023, 5023, "tcp" ] + [1433, 1433, "tcp"], + [5023, 5023, "tcp"] ] } resource "aws_security_group" "this_security_group" { - name = local.name + name = local.name description = local.description - vpc_id = var.vpc_id + vpc_id = var.vpc_id dynamic "ingress" { for_each = local.ports iterator = p content { description = local.description - from_port = p.value[0] - to_port = p.value[1] - protocol = p.value[2] - cidr_blocks = [ "0.0.0.0/0" ] + from_port = p.value[0] + to_port = p.value[1] + protocol = p.value[2] + cidr_blocks = ["0.0.0.0/0"] } } egress { description = "ALL ${local.description}" - from_port = 0 - to_port = 0 - protocol = -1 - cidr_blocks = [ "0.0.0.0/0" ] + from_port = 0 + to_port = 0 + protocol = -1 + cidr_blocks = ["0.0.0.0/0"] } tags = merge( map("Name", local.name), var.tags, - map("boc:tf_module_version", var._module_version), + map("boc:tf_module_version", local._module_version), map("boc:vpc:info", join(" ", compact(list(var.vpc_id, var.vpc_full_name)))), ) } diff --git a/rds-mssql/output.tf b/rds-mssql/output.tf index f9c3840..fbdd35a 100644 --- a/rds-mssql/output.tf +++ b/rds-mssql/output.tf @@ -1,9 +1,9 @@ output "this_security_group_id" { description = "Created security group ID" - value = aws_security_group.this_security_group.id + value = aws_security_group.this_security_group.id } output "this_security_group_arn" { description = "Created security group ARN" - value = aws_security_group.this_security_group.arn + value = aws_security_group.this_security_group.arn } diff --git a/rds-mssql/variables.tf b/rds-mssql/variables.tf index f0d6a0e..eb8dfc2 100644 --- a/rds-mssql/variables.tf +++ b/rds-mssql/variables.tf @@ -1,19 +1,25 @@ variable "vpc_id" { description = "VPC ID Number" - type = string + type = string +} + +variable "vpc_full_name" { + description = "VPC full name" + type = string + default = "" } variable "name" { description = "Security group Name" - type = string - default = "m-rds-mssql" + type = string + default = "m-rds-mssql" } variable "tags" { description = "Extra security group tags" - type = map - default = { + type = map + default = { "CostAllocation" = "csvd:infrastructure" - "Environment" = "csvd-infrastructure" + "Environment" = "csvd-infrastructure" } } diff --git a/rds-mssql/version.tf b/rds-mssql/version.tf index 4284311..9103f73 100644 --- a/rds-mssql/version.tf +++ b/rds-mssql/version.tf @@ -1,5 +1,3 @@ -variable "_module_version" { - description = "Module version number" - type = string - default = "1.5" +locals { + _module_version = "1.6" }