forked from joshuamkite/terraform-aws-ssh-bastion-service
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathlocals.tf
50 lines (42 loc) · 1.58 KB
/
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
##########################
#Create local for bastion hostname
##########################
locals {
bastion_vpc_name = "${var.bastion_vpc_name == "vpc_id" ? var.vpc : var.bastion_vpc_name}"
bastion_host_name = "${module.label.id}"
}
##########################
# Logic for security group and listeners
##########################
locals {
hostport_whitelisted = "${(join(",", var.cidr_blocks_whitelist_host) !="") }"
hostport_healthcheck = "${(var.lb_healthcheck_port == "2222")}"
}
##########################
# Logic tests for assume role vs same account
##########################
locals {
assume_role_yes = "${var.assume_role_arn != "" ? 1 : 0}"
assume_role_no = "${var.assume_role_arn == "" ? 1 : 0}"
}
##########################
# Logic for using module default userdata sections or not
##########################
locals {
custom_ssh_populate_no = "${var.custom_ssh_populate == "" ? 1 : 0}"
custom_authorized_keys_command_no = "${var.custom_authorized_keys_command == "" ? 1 : 0}"
custom_docker_setup_no = "${var.custom_docker_setup == "" ? 1 : 0}"
custom_systemd_no = "${var.custom_systemd == "" ? 1 : 0}"
}
##########################
# Logic for using module default or custom ami
##########################
locals {
bastion_ami_id = "${var.custom_ami_id == "" ? data.aws_ami.debian.id : var.custom_ami_id}"
}
##########################
# Logic for using cidr_blocks_whitelist_service ONLY if provided
##########################
locals {
cidr_blocks_whitelist_service_yes = "${(join(",", var.cidr_blocks_whitelist_service)) != "" ? 1 : 0}"
}