Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions examples/complete/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ module "vpc" {
intra_subnet_names = []

create_database_subnet_group = false
create_intra_subnet_group = false
manage_default_network_acl = false
manage_default_route_table = false
manage_default_security_group = false
Expand Down
16 changes: 16 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -859,6 +859,22 @@ resource "aws_subnet" "intra" {
)
}

resource "aws_db_subnet_group" "intra" {
count = local.create_intra_subnets && var.create_intra_subnet_group ? 1 : 0

name = lower(coalesce(var.intra_subnet_group_name, "${var.name}-intra"))
description = "Intra subnet group for ${var.name}"
subnet_ids = aws_subnet.intra[*].id

tags = merge(
{
"Name" = lower(coalesce(var.intra_subnet_group_name, "${var.name}-intra"))
},
var.tags,
var.intra_subnet_group_tags,
)
}

locals {
num_intra_route_tables = var.create_multiple_intra_route_tables ? local.len_intra_subnets : 1
}
Expand Down
11 changes: 11 additions & 0 deletions outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -505,6 +505,17 @@ output "intra_network_acl_arn" {
value = try(aws_network_acl.intra[0].arn, null)
}

output "intra_subnet_group" {
description = "ID of intra subnet group"
value = try(aws_db_subnet_group.intra[0].id, null)
}

output "intra_subnet_group_name" {
description = "Name of intra subnet group"
value = try(aws_db_subnet_group.intra[0].name, null)
}


################################################################################
# NAT Gateway
################################################################################
Expand Down
18 changes: 18 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -992,6 +992,24 @@ variable "intra_route_table_tags" {
default = {}
}

variable "create_intra_subnet_group" {
description = "Controls if RDS subnet group should be created (n.b. intra_subnets must also be set)"
type = bool
default = true
}

variable "intra_subnet_group_name" {
description = "Name of intra subnet group"
type = string
default = null
}

variable "intra_subnet_group_tags" {
description = "Additional tags for the intra subnet group"
type = map(string)
default = {}
}

################################################################################
# Intra Network ACLs
################################################################################
Expand Down
Loading