-
Notifications
You must be signed in to change notification settings - Fork 0
/
locals.container.app.job.tf
102 lines (99 loc) · 3.9 KB
/
locals.container.app.job.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
locals {
keda_meta_data = tomap(jsondecode(local.keda_meta_data_final))
keda_meta_data_azure_devops = {
poolName = var.version_control_system_pool_name
targetPipelinesQueueLength = var.version_control_system_agent_target_queue_length
}
keda_meta_data_final = var.version_control_system_type == local.version_control_system_azure_devops ? jsonencode(local.keda_meta_data_azure_devops) : jsonencode(local.keda_meta_data_github)
keda_meta_data_github = {
owner = var.version_control_system_organization
repos = var.version_control_system_repository
targetWorkflowQueueLength = var.version_control_system_agent_target_queue_length
runnerScope = var.version_control_system_runner_scope
}
}
locals {
environment_variables = concat(tolist(jsondecode(local.environment_variables_final)), tolist(var.container_app_environment_variables))
environment_variables_azure_devops = [
{
name = "AZP_POOL"
value = var.version_control_system_pool_name
},
{
name = "AZP_AGENT_NAME_PREFIX"
value = local.version_control_system_agent_name_prefix
}
]
environment_variables_final = var.version_control_system_type == local.version_control_system_azure_devops ? jsonencode(local.environment_variables_azure_devops) : jsonencode(local.environment_variables_github)
environment_variables_github = [
{
name = "RUNNER_NAME_PREFIX"
value = local.version_control_system_agent_name_prefix
},
{
name = "REPO_URL"
value = local.github_repository_url
},
{
name = "RUNNER_SCOPE"
value = var.version_control_system_runner_scope
},
{
name = "EPHEMERAL"
value = "true"
},
{
name = "ORG_NAME"
value = var.version_control_system_organization
},
{
name = "ENTERPRISE_NAME"
value = var.version_control_system_enterprise
},
{
name = "RUNNER_GROUP"
value = var.version_control_system_runner_group
}
]
}
locals {
environment_variables_placeholder = tolist(jsondecode(local.environment_variables_placeholder_final))
environment_variables_placeholder_azure_devops = [
{
name = "AZP_AGENT_NAME"
value = local.version_control_system_placeholder_agent_name
},
{
name = "AZP_PLACEHOLDER"
value = "true"
}
]
environment_variables_placeholder_final = var.version_control_system_type == local.version_control_system_azure_devops ? jsonencode(local.environment_variables_placeholder_azure_devops) : jsonencode(local.environment_variables_placeholder_github)
environment_variables_placeholder_github = []
}
locals {
sensitive_environment_variables = concat(tolist(jsondecode(local.sensitive_environment_variables_final)), tolist(var.container_app_sensitive_environment_variables))
sensitive_environment_variables_azure_devops = [
{
name = "AZP_URL"
value = var.version_control_system_organization
container_app_secret_name = "organization-url"
keda_auth_name = "organizationURL"
},
{
name = "AZP_TOKEN"
value = var.version_control_system_personal_access_token
container_app_secret_name = "personal-access-token"
keda_auth_name = "personalAccessToken"
}
]
sensitive_environment_variables_final = var.version_control_system_type == local.version_control_system_azure_devops ? jsonencode(local.sensitive_environment_variables_azure_devops) : jsonencode(local.sensitive_environment_variables_github)
sensitive_environment_variables_github = [
{
name = "ACCESS_TOKEN"
value = var.version_control_system_personal_access_token
container_app_secret_name = "personal-access-token"
keda_auth_name = "personalAccessToken"
}
]
}