-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.tf
More file actions
44 lines (35 loc) · 1.15 KB
/
app.tf
File metadata and controls
44 lines (35 loc) · 1.15 KB
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
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
hds_resource = var.hds_resource
lifecycle {
precondition {
condition = !(var.github_integration != null && var.gitlab_integration != null)
error_message = "Only one of github_integration or gitlab_integration can be set, not both."
}
}
}
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
}