File tree Expand file tree Collapse file tree 3 files changed +45
-0
lines changed
Expand file tree Collapse file tree 3 files changed +45
-0
lines changed Original file line number Diff line number Diff line change @@ -859,6 +859,22 @@ resource "aws_subnet" "intra" {
859859 )
860860}
861861
862+ resource "aws_db_subnet_group" "intra" {
863+ count = local. create_intra_subnets && var. create_intra_subnet_group ? 1 : 0
864+
865+ name = lower (coalesce (var. intra_subnet_group_name , " ${ var . name } -intra" ))
866+ description = " Intra subnet group for ${ var . name } "
867+ subnet_ids = aws_subnet. intra [* ]. id
868+
869+ tags = merge (
870+ {
871+ " Name" = lower (coalesce (var. intra_subnet_group_name , " ${ var . name } -intra" ))
872+ },
873+ var. tags ,
874+ var. intra_subnet_group_tags ,
875+ )
876+ }
877+
862878locals {
863879 num_intra_route_tables = var. create_multiple_intra_route_tables ? local. len_intra_subnets : 1
864880}
Original file line number Diff line number Diff line change @@ -505,6 +505,17 @@ output "intra_network_acl_arn" {
505505 value = try (aws_network_acl. intra [0 ]. arn , null )
506506}
507507
508+ output "intra_subnet_group" {
509+ description = " ID of intra subnet group"
510+ value = try (aws_db_subnet_group. intra [0 ]. id , null )
511+ }
512+
513+ output "intra_subnet_group_name" {
514+ description = " Name of intra subnet group"
515+ value = try (aws_db_subnet_group. intra [0 ]. name , null )
516+ }
517+
518+
508519# ###############################################################################
509520# NAT Gateway
510521# ###############################################################################
Original file line number Diff line number Diff line change @@ -992,6 +992,24 @@ variable "intra_route_table_tags" {
992992 default = {}
993993}
994994
995+ variable "create_intra_subnet_group" {
996+ description = " Controls if RDS subnet group should be created (n.b. intra_subnets must also be set)"
997+ type = bool
998+ default = true
999+ }
1000+
1001+ variable "intra_subnet_group_name" {
1002+ description = " Name of intra subnet group"
1003+ type = string
1004+ default = null
1005+ }
1006+
1007+ variable "intra_subnet_group_tags" {
1008+ description = " Additional tags for the intra subnet group"
1009+ type = map (string )
1010+ default = {}
1011+ }
1012+
9951013# ###############################################################################
9961014# Intra Network ACLs
9971015# ###############################################################################
You can’t perform that action at this time.
0 commit comments