forked from spotinst/terraform-spotinst-ocean-eks
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlocals.tf
52 lines (45 loc) · 907 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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
locals {
subnets = (
var.subnets != null
? var.subnets
: module.vpc.private_subnets
)
vpc_id = (
var.vpc_id != null
? var.vpc_id
: module.vpc.vpc_id
)
ami_id = (
var.ami_id != null
? var.ami_id
: module.eks.workers_default_ami_id
)
cluster_name = (
var.cluster_name != null
? var.cluster_name
: "ocean-${random_string.suffix.result}"
)
ocean_cluster_id = (
var.create_ocean
? element(concat(spotinst_ocean_aws.this.*.id, [""]), 0)
: null
)
ocean_controller_id = (
var.cluster_identifier != null
? var.cluster_identifier
: module.eks.cluster_id
)
worker_user_data = (
var.worker_user_data != null
? var.worker_user_data
: <<-EOF
#!/bin/bash
set -o xtrace
/etc/eks/bootstrap.sh ${local.cluster_name}
EOF
)
}
resource "random_string" "suffix" {
length = 8
special = false
}