-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
85 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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, | ||
| ) | ||
| } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 | ||
| } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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" | ||
| } | ||
| } |