-
Notifications
You must be signed in to change notification settings - Fork 0
/
scm_integration.tf
42 lines (35 loc) · 1.46 KB
/
scm_integration.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
locals {
# Set scm_integration with :
# - the content of github_integration if it is not null (+ the type = "github")
# - the content of gitlab_integration if it is not null (+ the type = "gitlab")
# - an empty map otherwise
scm_integration = (var.github_integration != null
? { github = var.github_integration }
: (var.gitlab_integration != null
? { gitlab = var.gitlab_integration }
: {}
)
)
}
data "scalingo_scm_integration" "scm_integration" {
for_each = local.scm_integration
scm_type = each.key
}
resource "scalingo_scm_repo_link" "scm_repo_link" {
for_each = local.scm_integration
app = scalingo_app.app.id
source = each.value.repo_url
auth_integration_uuid = (each.value.integration_uuid != null
? each.value.integration_uuid
: data.scalingo_scm_integration.scm_integration[each.key].id
)
auto_deploy_enabled = each.value.auto_deploy_enabled
branch = each.value.branch
# Configuration for review apps
deploy_review_apps_enabled = var.review_apps.enabled
delete_on_close_enabled = var.review_apps.delete_on_close_enabled
hours_before_delete_on_close = var.review_apps.hours_before_delete_on_close
delete_stale_enabled = var.review_apps.delete_stale_enabled
hours_before_delete_stale = var.review_apps.hours_before_delete_stale
automatic_creation_from_forks_allowed = var.review_apps.automatic_creation_from_forks_allowed
}