forked from astronomer/terraform-aws-astronomer-aws
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathlocals.tf
33 lines (22 loc) · 943 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
23
24
25
26
27
28
29
30
31
32
33
resource "random_string" "suffix" {
length = 8
special = false
}
data aws_region current {}
locals {
cluster_name = "astronomer-${random_string.suffix.result}"
postgres_airflow_password = var.postgres_airflow_password == "" ? random_string.postgres_airflow_password[0].result : var.postgres_airflow_password
azs = ["${local.region}a", "${local.region}b"]
vpc_id = var.vpc_id == "" ? module.vpc.vpc_id : var.vpc_id
private_subnets = var.vpc_id == "" ? module.vpc.private_subnets : var.private_subnets
bring_your_own_db_subnets = length(var.db_subnets) > 0 ? var.db_subnets : local.private_subnets
database_subnets = var.vpc_id == "" ? module.vpc.database_subnets : local.bring_your_own_db_subnets
public_subnets = var.vpc_id == "" ? module.vpc.public_subnets : var.public_subnets
region = data.aws_region.current.name
tags = merge(
var.tags,
map(
"Deployment ID", var.deployment_id
)
)
}