terraform-provider-argocd icon indicating copy to clipboard operation
terraform-provider-argocd copied to clipboard

Use kube context - as `argocd --core`

Open nicraMarcin opened this issue 3 years ago • 1 comments

Hi, I have not exposed argo server, it is as ClusterIP. I'd like to connect to it using kubernetes api like argocd --core does

$ argocd version --core
argocd: v2.3.3+07ac038
  BuildDate: 2022-03-30T01:46:59Z
  GitCommit: 07ac038a8f97a93b401e824550f0505400a8c84e
  GitTreeState: clean
  GoVersion: go1.17.6
  Compiler: gc
  Platform: linux/amd64
argocd-server: v2.3.3+07ac038
  BuildDate: 2022-03-30T01:46:59Z
  GitCommit: 07ac038a8f97a93b401e824550f0505400a8c84e
  GitTreeState: clean
  GoVersion: go1.17.6
  Compiler: gc
  Platform: linux/amd64
  Ksonnet Version: unable to determine ksonnet version: exec: "ks": executable file not found in $PATH
  Kustomize Version: could not get kustomize version: exec: "kustomize": executable file not found in $PATH
  Helm Version: v3.8.2+g6e3701e
  Kubectl Version: v0.23.1
  Jsonnet Version: v0.18.0

How to configure this provider?

provider "argocd" {
  # Configuration options
  # server_addr = "kubernetes"
  insecure = true
  kubernetes {
    config_path = "~/.kube/config"
    config_context = "kind-monitor"
  }
}

server_addr attribure is required :( but if I set it with kubectl api it does't work.

Error: Missing required argument
│ 
│   with provider["registry.terraform.io/oboukili/argocd"],
│   on providers.tf line 10, in provider "argocd":
│   10: provider "argocd" {
│ 
│ "username": one of `auth_token,password,use_local_config,username` must be specified

nicraMarcin avatar May 10 '22 20:05 nicraMarcin

AFAIK, login --core cannot be used by 3rd-parties for now, since it simulates a local ArgoCD as a backend (and is not available in argo-cd package) I see that you have an argocd-server which makes the use of --core not mandatory for the terraform part. You can try with the port-forward flag so you can use the ClusterIP :


provider "argocd" {
  server_addr = "port-forward"
  username = ""  # <--- needed since not login core anymore
  password = ""  # <--- needed since not login core anymore

  port_forward  = true
  port_forward_with_namespace = "xxx" # <--- if not default namespace

  insecure = true
  kubernetes {
    config_path = "~/.kube/config"
    config_context = "kind-monitor"
  }
  grpc_web = true  # <-- might be needed depending on your config

MrLuje avatar Jun 26 '22 19:06 MrLuje