The code is used to patch the argocd config map to add SSO authentication.
resource "helm_release" "argocd" {
name = "argocd"
create_namespace = "true"
chart = "argo-cd"
namespace = "argocd"
version = "5.16.9"
repository = "https://argoproj.github.io/argo-helm"
set {
name = "configs.cm.url"
value = "https://cypherphage.com"
}
set {
name = "server.config.oidc\\.config"
value = yamlencode({
"name" = "Onelogin"
"issuer" = "https://example.onelogin"
"clientID" = "82348237984732927493928"
"clientSecret" = "hjsadjdhg38q7eaw"
"requestedScopes" = "['openid', 'profile', 'email', 'groups']"
})
}
}
The argocd-cm config map yaml file should look like this (focus on the requestedScopes key at the end) ->
apiVersion: v1
kind: ConfigMap
metadata:
name: argocd-cm
namespace: argocd
labels:
app.kubernetes.io/part-of: argocd
data:
url: https://<argocd.myproject.com>
oidc.config: |
name: OneLogin
issuer: https://<subdomain>.onelogin.com/oidc/2
clientID: aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaaaaaaaa
clientSecret: abcdef123456
# Optional set of OIDC scopes to request. If omitted, defaults to: ["openid", "profile", "email", "groups"]
requestedScopes: ["openid", "profile", "email", "groups"]
But I can't seem to create the yaml file where the value of key "requestedScopes" is in a single line like
requestedScopes: ["openid", "profile", "email", "groups"]
The best I could achieve was:
requestedScopes:
- openid
- profile
- email
What I have tried:
"requestedScopes" = "['openid', 'profile', 'email', 'groups']"
"requestedScopes" = "[\"openid\", \"profile\", \"email\", \"groups\"]"
Errors that I get:
helm_release.argocd: Modifying... [id=argocd]
╷
│ Error: failed parsing key "server.config.oidc\\.config" with value "clientID": "82348237984732927493928"
│ "clientSecret": "hjsadjdhg38q7eaw"
│ "issuer": "https://example.onelogin"
│ "name": "Onelogin"
│ "requestedScopes": "['openid', 'profile', 'email', 'groups']"
│ , key " 'profile'" has no value (cannot end with ,)
│
│ with helm_release.argocd,
│ on main.tf line 38, in resource "helm_release" "argocd":
│ 38: resource "helm_release" "argocd" {
╷
│ Error: failed parsing key "server.config.oidc\\.config" with value "clientID": "82348237984732927493928"
│ "clientSecret": "hjsadjdhg38q7eaw"
│ "issuer": "https://example.onelogin"
│ "name": "Onelogin"
│ "requestedScopes": "[\"openid\", \"profile\", \"email\", \"groups\"]"
│ , key " \"profile\"" has no value (cannot end with ,)
│
│ with helm_release.argocd,
│ on main.tf line 26, in resource "helm_release" "argocd":
│ 26: resource "helm_release" "argocd" {
Bit late but this is how i went about it, just provide it all as a string