forked from lablabs/terraform-aws-eks-external-dns
-
Notifications
You must be signed in to change notification settings - Fork 0
/
argo.tf
55 lines (49 loc) · 1.6 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
locals {
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" : var.helm_release_name
"parameters" : [for k, v in var.settings : tomap({ "forceString" : true, "name" : k, "value" : v })]
"values" : data.utils_deep_merge_yaml.values[0].output
}
}
"destination" : {
"server" : var.argo_destionation_server
"namespace" : var.k8s_namespace
}
"syncPolicy" : var.argo_sync_policy
"info" : var.argo_info
}
}
data "utils_deep_merge_yaml" "argo_application_values" {
count = var.enabled && var.argo_application_enabled && var.argo_application_use_helm ? 1 : 0
input = compact([
yamlencode(local.argo_application_values),
var.argo_application_values
])
}
resource "helm_release" "argocd_application" {
count = var.enabled && var.argo_application_enabled && var.argo_application_use_helm ? 1 : 0
chart = "${path.module}/helm/argocd-application"
name = var.helm_release_name
namespace = var.argo_namespace
values = [
data.utils_deep_merge_yaml.argo_application_values[0].output
]
}
resource "kubernetes_manifest" "self" {
count = var.enabled && var.argo_application_enabled && !var.argo_application_use_helm ? 1 : 0
manifest = {
"apiVersion" = "argoproj.io/v1alpha1"
"kind" = "Application"
"metadata" = {
"name" = var.helm_release_name
"namespace" = var.argo_namespace
}
"spec" = local.argo_application_values
}
}