-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added flags to enable the creation of additional db_subnet_groups for both private and public subnets. By default, secure remains trhe default, but now the configuration allows for the creation of up to two additional subnet groups (private and public).
- Loading branch information
Showing
4 changed files
with
74 additions
and
14 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
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
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
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 |
---|---|---|
@@ -1,13 +1,45 @@ | ||
resource "aws_db_subnet_group" "secure" { | ||
name = lower(format(local.names[var.name_pattern].db_subnet, var.name, local.name_suffix)) | ||
subnet_ids = aws_subnet.secure[*].id | ||
count = var.create_dbsubgroup_secure ? 1 : 0 | ||
name = lower("${format(local.names[var.name_pattern].db_subnet, var.name, local.name_suffix)}-secure") | ||
subnet_ids = aws_subnet.secure.*.id | ||
|
||
tags = merge( | ||
var.tags, | ||
{ | ||
"Name" = format(local.names[var.name_pattern].db_subnet, var.name, local.name_suffix) | ||
"Name" = "${format(local.names[var.name_pattern].db_subnet, var.name, local.name_suffix)}-secure" | ||
"Scheme" = "secure" | ||
"EnvName" = var.name | ||
}, | ||
) | ||
} | ||
|
||
resource "aws_db_subnet_group" "private" { | ||
count = var.create_dbsubgroup_private ? 1 : 0 | ||
name = lower("${format(local.names[var.name_pattern].db_subnet, var.name, local.name_suffix)}-private") | ||
subnet_ids = aws_subnet.private.*.id | ||
|
||
tags = merge( | ||
var.tags, | ||
{ | ||
"Name" = "${format(local.names[var.name_pattern].db_subnet, var.name, local.name_suffix)}-private" | ||
"Scheme" = "private" | ||
"EnvName" = var.name | ||
}, | ||
) | ||
} | ||
|
||
resource "aws_db_subnet_group" "public" { | ||
count = var.create_dbsubgroup_public ? 1 : 0 | ||
name = lower("${format(local.names[var.name_pattern].db_subnet, var.name, local.name_suffix)}-public") | ||
subnet_ids = aws_subnet.public.*.id | ||
|
||
tags = merge( | ||
var.tags, | ||
{ | ||
"Name" = "${format(local.names[var.name_pattern].db_subnet, var.name, local.name_suffix)}-public" | ||
"Scheme" = "public" | ||
"EnvName" = var.name | ||
}, | ||
) | ||
} | ||
|