-
Notifications
You must be signed in to change notification settings - Fork 0
/
test-app.tf
94 lines (92 loc) · 2.32 KB
/
test-app.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
resource "kubectl_manifest" "test_app_project" {
yaml_body = yamlencode({
apiVersion = "argoproj.io/v1alpha1"
kind = "AppProject"
metadata = {
name = "test-app-project"
namespace = kubernetes_namespace.argo.metadata[0].name
finalizers = [
"resources-finalizer.argocd.argoproj.io" # Finalizer that ensures that project is not deleted until it is not referenced by any application
]
}
spec = {
description = "Project for all test apps"
sourceRepos = [ "${var.source_repo_url}" ]
destinations = [
{
namespace = "default"
server = "https://kubernetes.default.svc"
}
]
clusterResourceWhitelist = [
{
group = "*"
kind = "*"
}
]
orphanedResources = {
warn = false
}
}
})
depends_on = [helm_release.argo_cd]
}
resource "kubectl_manifest" "test_app" {
for_each = toset(["staging", "production"])
yaml_body = yamlencode({
apiVersion = "argoproj.io/v1alpha1"
kind = "Application"
metadata = {
name = "test-app-${each.value}"
namespace = kubernetes_namespace.argo.metadata[0].name
labels = {
environment = "${each.value}"
}
finalizers = [
"resources-finalizer.argocd.argoproj.io"
]
}
spec = {
project = "test-app-project"
source = {
repoURL = "${var.source_repo_url}"
targetRevision = "${each.value}"
path = "./"
helm = {
parameters = [
{
name = "service.type"
value = "NodePort"
},
{
name = "nameOverride"
value = "test-app-${each.value}"
},
{
name = "ingress.enabled"
value = "false"
},
{
name = "hooks.enabled"
value = "false"
},
{
name = "hooks.slackToken"
value = ""
},
]
}
}
destination = {
server = "https://kubernetes.default.svc"
namespace = "default"
}
# syncPolicy = {
# automated = {
# prune = true
# }
# }
}
})
depends_on = [helm_release.argo_cd]
}