Skip to content

Commit

Permalink
add vpc_full_name
Browse files Browse the repository at this point in the history
  • Loading branch information
badra001 committed Dec 23, 2020
1 parent 56b7dc1 commit 75306e3
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 26 deletions.
29 changes: 15 additions & 14 deletions rds-mssql/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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 = { }
* }
Expand All @@ -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)))),
)
}
4 changes: 2 additions & 2 deletions rds-mssql/output.tf
Original file line number Diff line number Diff line change
@@ -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
}
18 changes: 12 additions & 6 deletions rds-mssql/variables.tf
Original file line number Diff line number Diff line change
@@ -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"
}
}
6 changes: 2 additions & 4 deletions rds-mssql/version.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
variable "_module_version" {
description = "Module version number"
type = string
default = "1.5"
locals {
_module_version = "1.6"
}

0 comments on commit 75306e3

Please sign in to comment.