File tree Expand file tree Collapse file tree 2 files changed +108
-3
lines changed Expand file tree Collapse file tree 2 files changed +108
-3
lines changed Original file line number Diff line number Diff line change 1+ resource "argocd_project" "projects" {
2+ for_each = var. project_spaces
3+ metadata {
4+ name = each. key
5+ namespace = " argocd"
6+ }
7+
8+ spec {
9+ description = each. value . description
10+
11+ source_repos = [" *" ]
12+
13+
14+ dynamic "destination" {
15+ for_each = each. value . destinations
16+ iterator = DESTINATION
17+ content {
18+ name = DESTINATION. value . name
19+ namespace = DESTINATION. value . namespace
20+ }
21+ }
22+
23+ dynamic "cluster_resource_whitelist" {
24+ for_each = each. value . cluster-allows
25+ iterator = ALLOW
26+ content {
27+ group = ALLOW. value . group
28+ kind = ALLOW. value . kind
29+ }
30+ }
31+
32+ }
33+ }
34+
35+
36+
137
238# Our app of apps that bootstraps the Platform team's setup.
339resource "argocd_application" "app-of-apps" {
@@ -47,7 +83,7 @@ resource "argocd_application" "app-of-components" {
4783 destination {
4884 name = " in-cluster"
4985 }
50- project = " default "
86+ project = " components "
5187
5288 source {
5389 repo_url = var. source_repo_url
@@ -82,12 +118,11 @@ resource "argocd_application" "app-of-kargo" {
82118 destination {
83119 name = " in-cluster"
84120 }
85- project = " default "
121+ project = " kargo "
86122
87123 source {
88124 repo_url = var. source_repo_url
89125 path = " kargo"
90-
91126 directory {
92127 recurse = false
93128 }
Original file line number Diff line number Diff line change @@ -25,4 +25,74 @@ variable "source_directory_path" {
2525 type = string
2626 default = " apps"
2727
28+ }
29+
30+ variable "project_spaces" {
31+ description = " Project spaces allow apps to be logically grouped."
32+ type = map (object (
33+ {
34+ name = string
35+ description = string
36+ destinations = list (object ({
37+ name = string
38+ namespace = string
39+ }))
40+ cluster-allows = list (object ({
41+ group = string
42+ kind = string
43+ }))
44+ }
45+ ))
46+ default = {
47+ " components" = {
48+ " name" = " components"
49+ " description" = " Cluster addons, components"
50+ " destinations" = [{
51+ name = " *"
52+ namespace = " *"
53+ }]
54+ " cluster-allows" = [{
55+ group = " *"
56+ kind = " *"
57+ }]
58+ }
59+
60+ " pattern-apps" = {
61+ " name" = " pattern-apps"
62+ " description" = " For apps using org-wide standard ABC"
63+ " destinations" = [{
64+ name = " *"
65+ namespace = " *"
66+ }]
67+ " cluster-allows" = [{
68+ group = " *"
69+ kind = " Namespace"
70+ }]
71+ }
72+
73+ " kargo" = {
74+ " name" = " kargo"
75+ " description" = " Kargo definitions only"
76+ " destinations" = [{
77+ name = " kargo"
78+ namespace = " *"
79+ }]
80+ " cluster-allows" = [{
81+ group = " *"
82+ kind = " *"
83+ }]
84+ }
85+ " rollouts" = {
86+ " name" = " rollouts"
87+ " description" = " Various progressive release demos"
88+ " destinations" = [{
89+ name = " *"
90+ namespace = " *"
91+ }]
92+ " cluster-allows" = [{
93+ group = " *"
94+ kind = " *"
95+ }]
96+ }
97+ }
2898}
You can’t perform that action at this time.
0 commit comments