Skip to content

Commit

Permalink
add rds-mssql
Browse files Browse the repository at this point in the history
  • Loading branch information
badra001 committed Oct 10, 2019
1 parent b95e50e commit 2198ae2
Show file tree
Hide file tree
Showing 3 changed files with 85 additions and 0 deletions.
57 changes: 57 additions & 0 deletions rds-mssql/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/**
* # About
*
* This describes how to use the aws-common-security-groups submodule for rds-mssql
*
* # Usage
*
* ```code
* module "rds-mssql" {
* source = "git::https://vc1.csvd.census.gov/terraform-modules/aws-common-security-groups.git//rds-mssql"
*
* # name = "m-rds-mssql"
* vpc_id = var.vpc_id
* # Name, CostAllocation, and Environment are pre-set
* # tags = { }
* }
* ```
*/

locals {
description = "module: MS SQL Server Common Ports"
name = var.name
ports = [
[ 1433, 1433, "tcp" ]
]
}

resource "aws_security_group" "this_security_group" {
name = local.name
description = local.description
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" ]
}
}

egress {
description = "ALL: ${local.description}"
from_port = 0
to_port = 0
protocol = -1
cidr_blocks = [ "0.0.0.0/0" ]
}

tags = merge(
map("Name", local.name),
var.tags,
)
}
9 changes: 9 additions & 0 deletions rds-mssql/output.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
output "this_security_group_id" {
description = "Created 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
}
19 changes: 19 additions & 0 deletions rds-mssql/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
variable "vpc_id" {
description = "VPC ID Number"
type = string
}

variable "name" {
description = "Security group Name"
type = string
default = "m-rds-mssql"
}

variable "tags" {
description = "Extra security group tags"
type = map
default = {
"CostAllocation" = "csvd:infrastructure"
"Environment" = "csvd-infrastructure"
}
}

0 comments on commit 2198ae2

Please sign in to comment.