generated from cds-snc/project-template
-
Notifications
You must be signed in to change notification settings - Fork 4
/
locals.tf
22 lines (18 loc) · 1011 Bytes
/
locals.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
data "aws_region" "current" {}
locals {
common_tags = {
(var.billing_tag_key) = var.billing_tag_value
Terraform = "true"
}
identifier = "${var.name}-cluster"
is_mysql = var.engine == "aurora-mysql"
database_port = local.is_mysql ? 3306 : 5432
engine_family = local.is_mysql ? "MYSQL" : "POSTGRESQL"
proxy_name = "${var.name}-proxy"
region = data.aws_region.current.name
security_group_desc_target = var.use_proxy ? "proxy" : "application"
security_group_ids = distinct(concat([aws_security_group.rds.id], var.security_group_ids))
security_group_name = var.use_proxy ? "${var.name}_rds_proxy_sg" : "${var.name}_rds_sg"
# Configure the database logs that are exported to CloudWatch. Default to none for MySQL and `postgresql` for Postgres if no values are specified
enabled_cloudwatch_logs_exports = length(var.enabled_cloudwatch_logs_exports) > 0 ? var.enabled_cloudwatch_logs_exports : (local.is_mysql ? [] : ["postgresql"])
}