argoproj-labs/terraform-provider-argocd

Issues with Parameters with dot in its name

thormode opened this issue · 1 comments

Terraform version:
ArgoCD provider version: v6.0.3
ArgoCD version: v2.9.0+48f4392


## Terraform configuration
resource "argocd_application" "helm_grafana" {
  metadata {
    name      = "grafana"
    namespace = "argocd"
  }
  spec {
    destination {
      server    = "https://xxx.privatelink.xxx.azmk8s.io:443"
      namespace = "monitoring"
    }
    source {
      repo_url        = "https://grafana.github.io/helm-charts"
      chart           = "grafana"
      target_revision = "7.3.0"
      helm {
        parameter {
          name  = "persistence.enabled"
          value = "true"
        }
        parameter {
          name  = "assertNoLeakedSecrets"
          value = "false"
        }
        parameter {
          name  = "grafana.ini.auth.azuread.name"
          value = "Azure AD"
        }
        parameter {
          name  = "grafana.ini.auth.azuread.enabled"
          value = "true"
        }
        parameter {
          name  = "grafana.ini.auth.azuread.allow_sign_up"
          value = "true"
        }
        parameter {
          name  = "grafana.ini.auth.azuread.auto_login"
          value = "false"
        }
        parameter {
          name  = "grafana.ini.auth.azuread.client_id"
          value = "xxxxxxxxxx"
        }
        parameter {
          name  = "grafana.ini.auth.azuread.client_secret"
          value = "xxxxxxxxxx"
        }
        parameter {
          name  = "grafana.ini.auth.azuread.scopes"
          value = "openid email profile"
        }
        parameter {
          name  = "grafana.ini.auth.azuread.auth_url"
          value = "https://login.microsoftonline.com/xxxxxxxxxx/oauth2/v2.0/authorize"
        }
        parameter {
          name  = "grafana.ini.auth.azuread.token_url"
          value = "https://login.microsoftonline.com/xxxxxxxxxx/oauth2/v2.0/token"
        }
        parameter {
          name  = "grafana.ini.auth.azuread.allowed_organizations"
          value = "xxxxxxxxxx"
        }
        parameter {
          name  = "grafana.ini.auth.azuread.role_attribute_strict"
          value = "false"
        }
        parameter {
          name  = "grafana.ini.auth.azuread.allow_assign_grafana_admin"
          value = "false"
        }
        parameter {
          name  = "grafana.ini.auth.azuread.skip_org_role_sync"
          value = "false"
        }
        parameter {
          name  = "grafana.ini.auth.azuread.use_pkce"
          value = "true"
        }
      }
    }
    sync_policy {
      automated {
        prune       = true
        self_heal   = false
        allow_empty = true
      }
    }
  }
}
ArgoCD application parameters:
![image](https://github.com/oboukili/terraform-provider-argocd/assets/57448668/a5359f2e-dd3f-45f6-a385-174c52bac414)


## Question
Hi!
Having issues adding parameters with a dot (.) in its name, in this example "grafana.ini" and "auth.azuread".
Eventough it seems like it got added (look at attached image of argocd parameters) the login button for "Sign in with AzureAD" is missing.
I've tested my settings with helm install grafana grafana/grafana -f values.yaml with the same settings as above:
grafana.ini:
  auth.azuread:
    name: Azure AD
    enabled: true
    allow_sign_up: true
    auto_login: false
    client_id: xxxxxxx
    client_secret: xxxxxxx
    scopes: openid email profile
    auth_url: https://login.microsoftonline.com/xxxxxxx/oauth2/v2.0/authorize
    token_url: https://login.microsoftonline.com/xxxxxxx/oauth2/v2.0/token
    allowed_groups: xxxxxxx
    allowed_organizations: 
    
This works great.

What else I've tried:
**adding as values:**
helm {....
  values = "<<EOT
       grafana.ini:
          auth.azuread:
            enabled               = true
            name                  = "Azure AD"
            allow_sign_up         = true
            auto_login            = false
            client_id             = "xxxxxxx"
            client_secret         = "xxxxxxx"
            scopes                = "openid email profile"
            auth_url              = "https://login.microsoftonline.com/xxxxxxx/oauth2/v2.0/authorize"
            token_url             = "https://login.microsoftonline.com/xxxxxxx/oauth2/v2.0/token"
            allowed_organizations = "xxxxxxx"   
        EOT
**adding with backslash**

  parameter {
          name  = "grafana.ini\\.auth.azuread\\.enabled"
          value = "true"
        }
        
       
Nothing seems to work. Am I missing some easy fix?
Solution:
        values = yamlencode({
          "grafana.ini" = {
            "auth.azuread" = {
              name                  = "Azure AD"
              enabled               = "true"
              allow_sign_up         = "true"
              auto_login            = "false"
              client_id             = "xxxxxxx"
              client_secret         = "xxxxxxx"
              scopes                = "openid email profile"
              auth_url              = "https://login.microsoftonline.com/xxxxxxx/oauth2/v2.0/authorize"
              token_url             = "https://login.microsoftonline.com/xxxxxxx/oauth2/v2.0/token"
              allowed_organizations = "xxxxxxx"
            }
          }