-
Notifications
You must be signed in to change notification settings - Fork 0
/
argo.tf
57 lines (53 loc) · 1.63 KB
/
argo.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
locals {
argo_application_metadata = {
"labels" : try(var.argo_metadata.labels, {}),
"annotations" : try(var.argo_metadata.annotations, {}),
"finalizers" : try(var.argo_metadata.finalizers, [])
}
argo_application_values = {
"project" : var.argo_project
"source" : {
"repoURL" : var.helm_repo_url
"chart" : var.helm_chart_name
"targetRevision" : var.helm_chart_version
"helm" : {
"releaseName" : local.helm_release_name
"parameters" : [for k, v in var.settings : tomap({ "forceString" : true, "name" : k, "value" : v })]
"values" : var.enabled ? data.utils_deep_merge_yaml.values[0].output : ""
}
}
"destination" : {
"server" : var.argo_destination_server
"namespace" : var.namespace
}
"syncPolicy" : var.argo_sync_policy
"info" : var.argo_info
}
}
resource "kubernetes_manifest" "this" {
count = var.enabled && var.argo_enabled && !var.argo_helm_enabled ? 1 : 0
manifest = {
"apiVersion" = var.argo_apiversion
"kind" = "Application"
"metadata" = merge(
local.argo_application_metadata,
{ "name" = local.helm_release_name },
{ "namespace" = var.argo_namespace },
)
"spec" = merge(
local.argo_application_values,
var.argo_spec
)
}
computed_fields = var.argo_kubernetes_manifest_computed_fields
field_manager {
name = var.argo_kubernetes_manifest_field_manager_name
force_conflicts = var.argo_kubernetes_manifest_field_manager_force_conflicts
}
wait {
fields = var.argo_kubernetes_manifest_wait_fields
}
lifecycle {
create_before_destroy = true
}
}