-
Notifications
You must be signed in to change notification settings - Fork 7
/
locals.tf
22 lines (21 loc) · 980 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
locals {
tags = merge(
var.tags,
{
"Name" = "${var.env}-${var.name}"
"Environment" = var.env
},
)
rds_security_group_ids = concat(
[module.rds_sg.security_group_id],
flatten(data.aws_security_groups.for_rds[*].ids),
)
dynamodb_iam_enabled = var.dynamodb_enabled || var.dynamodb2_enabled || var.dynamodb3_enabled || var.dynamodb4_enabled
dynamodb_tables_arns = concat(
var.dynamodb_enabled && var.iam_role_enabled ? ["arn:aws:dynamodb:*:*:table/${module.dynamodb.table_id}"] : [],
var.dynamodb2_enabled && var.iam_role_enabled ? ["arn:aws:dynamodb:*:*:table/${module.dynamodb2.table_id}"] : [],
var.dynamodb3_enabled && var.iam_role_enabled ? ["arn:aws:dynamodb:*:*:table/${module.dynamodb3.table_id}"] : [],
var.dynamodb4_enabled && var.iam_role_enabled ? ["arn:aws:dynamodb:*:*:table/${module.dynamodb4.table_id}"] : [],
)
dynamodb_tables_records = [for t in toset(local.dynamodb_tables_arns) : "${t}/*"]
}