-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.tf
36 lines (28 loc) · 910 Bytes
/
app.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
data "scalingo_stack" "stack" {
name = var.stack
}
resource "scalingo_app" "app" {
name = var.name
environment = var.environment
stack_id = data.scalingo_stack.stack.id
force_https = !var.authorize_unsecure_http
sticky_session = var.sticky_session
router_logs = var.router_logs
}
resource "scalingo_container_type" "containers" {
for_each = var.containers
app = scalingo_app.app.id
name = each.key
amount = each.value.amount
size = each.value.size
}
# auto scaler
resource "scalingo_autoscaler" "autoscalers" {
for_each = { for k, v in var.containers : k => v if v.autoscaler != null }
app = scalingo_app.app.id
container_type = each.key
metric = each.value.autoscaler.metric
target = each.value.autoscaler.target
min_containers = each.value.autoscaler.min_containers
max_containers = each.value.autoscaler.max_containers
}