Skip to content

Commit 82839aa

Browse files
committed
chore: renamed deploy-argocd to terraform to respect file structure
1 parent 67f9f3f commit 82839aa

File tree

13 files changed

+131
-208
lines changed

13 files changed

+131
-208
lines changed

argocd/deploy-argocd/.gitignore

Lines changed: 0 additions & 28 deletions
This file was deleted.

argocd/deploy-argocd/README.md

Lines changed: 0 additions & 15 deletions
This file was deleted.

argocd/deploy-argocd/main.tf

Lines changed: 0 additions & 98 deletions
This file was deleted.

argocd/deploy-argocd/provider.tf

Lines changed: 0 additions & 28 deletions
This file was deleted.

argocd/deploy-argocd/terraform.tfvars.template

Lines changed: 0 additions & 6 deletions
This file was deleted.

argocd/deploy-argocd/variables.tf

Lines changed: 0 additions & 33 deletions
This file was deleted.

argocd/terraform/locals.tf

Whitespace-only changes.

argocd/terraform/main.tf

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
# =============================================================================
2+
# SECTION 1: KEYCLOAK CONFIGURATION
3+
# Configure the existing Keycloak to accept ArgoCD logins
4+
# =============================================================================
5+
6+
# 1. Create the OIDC Client
7+
resource "keycloak_openid_client" "argocd" {
8+
realm_id = var.target_realm
9+
client_id = "argocd-client"
10+
name = "ArgoCD"
11+
enabled = true
12+
access_type = "CONFIDENTIAL"
13+
standard_flow_enabled = true
14+
direct_access_grants_enabled = true
15+
16+
# This must match your ArgoCD URL exactly
17+
valid_redirect_uris = [
18+
"${var.argocd_url}/auth/callback",
19+
"${var.argocd_url}/*" # Temporary wildcard to troubleshoot
20+
]
21+
}
22+
23+
resource "keycloak_openid_client_default_scopes" "client_default_scopes" {
24+
realm_id = var.target_realm
25+
client_id = keycloak_openid_client.argocd.id
26+
27+
default_scopes = [
28+
"openid",
29+
"profile",
30+
"email",
31+
"roles"
32+
]
33+
}
34+
35+
# 2. Create the Client Secret
36+
# (The provider generates this automatically, we just access it later)
37+
38+
# 3. Create Group Mapper
39+
# This ensures Keycloak sends the "groups" claim so ArgoCD can do RBAC
40+
resource "keycloak_openid_group_membership_protocol_mapper" "groups" {
41+
realm_id = var.target_realm
42+
client_id = keycloak_openid_client.argocd.id
43+
name = "group-mapper"
44+
claim_name = "groups"
45+
full_path = false
46+
}
47+
48+
# =============================================================================
49+
# SECTION 2: ARGOCD DEPLOYMENT (HELMS)
50+
# Deploy ArgoCD to GKE and inject the secrets from Section 1
51+
# =============================================================================
52+
53+
resource "helm_release" "argocd-test" {
54+
name = "argocd"
55+
repository = "https://argoproj.github.io/argo-helm"
56+
chart = "argo-cd"
57+
namespace = "argocd-test"
58+
create_namespace = true
59+
version = "5.51.0"
60+
skip_crds = true
61+
62+
# Using values (YAML) instead of set avoids comma parsing errors entirely
63+
values = [
64+
yamlencode({
65+
configs = {
66+
cm = {
67+
url = var.argocd_url
68+
"oidc.config" = yamlencode({
69+
name = "Keycloak"
70+
issuer = "${var.keycloak_url}/realms/${var.target_realm}"
71+
clientID = keycloak_openid_client.argocd.client_id
72+
clientSecret = keycloak_openid_client.argocd.client_secret
73+
requestedScopes = ["openid", "profile", "email"]
74+
75+
rootCA = ""
76+
})
77+
}
78+
rbac = {
79+
"policy.csv" = "g, /ArgoCDAdmins, role:admin"
80+
}
81+
}
82+
server = {
83+
service = {
84+
type = "LoadBalancer"
85+
}
86+
}
87+
})
88+
]
89+
}
90+
91+
# =============================================================================
92+
# OUTPUTS
93+
# =============================================================================
94+
95+
output "argocd_admin_secret" {
96+
value = keycloak_openid_client.argocd.client_secret
97+
sensitive = true
98+
}

argocd/terraform/outputs.tf

Whitespace-only changes.

argocd/terraform/values/argocd-dev-values.yaml

Whitespace-only changes.

0 commit comments

Comments
 (0)