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

terraform apply "Still creating" for ever

Open kokolight opened this issue 3 years ago • 8 comments

Whenever I try to apply the command just loading for ever.

Output:

argocd_project.myproject: Creating...
argocd_project.myproject: Still creating... [10s elapsed]
argocd_project.myproject: Still creating... [20s elapsed]
argocd_project.myproject: Still creating... [30s elapsed]
argocd_project.myproject: Still creating... [40s elapsed]
argocd_project.myproject: Still creating... [50s elapsed]
argocd_project.myproject: Still creating... [1m0s elapsed]
argocd_project.myproject: Still creating... [1m10s elapsed]
argocd_project.myproject: Still creating... [1m21s elapsed]
argocd_project.myproject: Still creating... [1m31s elapsed]
argocd_project.myproject: Still creating... [1m41s elapsed]
argocd_project.myproject: Still creating... [1m51s elapsed]
argocd_project.myproject: Still creating... [2m1s elapsed]
argocd_project.myproject: Still creating... [2m11s elapsed]

The code:

resource "argocd_project" "myproject" {
  metadata {
    name      = "test"
    namespace = "default"
    labels = {
      acceptance = "true"
    }
  }

  spec {
    description  = "simple project"
    source_repos = ["*"]

    destination {
      server    = "https://kubernetes.default.svc"
      namespace = "default"
    }
  }
}

The provider:

terraform {
  required_providers {
    argocd = {
      source  = "registry.terraform.io/oboukili/argocd"
      version = "2.1.0"
    }
  }
}

provider "argocd" {
  server_addr = "# My server address"
  username = "my_username"
  password = "my_password"
}

I just took a simple example from github, I tried both - user name and password - and auth token, none of them worked.

in debug mode:

2021/12/21 11:14:14 [TRACE] dag/walk: vertex "meta.count-boundary (EachMode fixup)" is waiting for "argocd_project.myproject"
2021/12/21 11:14:14 [TRACE] dag/walk: vertex "provider[\"registry.terraform.io/oboukili/argocd\"] (close)" is waiting for "argocd_project.myproject"
2021/12/21 11:14:14 [TRACE] dag/walk: vertex "root" is waiting for "meta.count-boundary (EachMode fixup)"
2021/12/21 11:14:19 [TRACE] dag/walk: vertex "root" is waiting for "meta.count-boundary (EachMode fixup)"
2021/12/21 11:14:19 [TRACE] dag/walk: vertex "meta.count-boundary (EachMode fixup)" is waiting for "argocd_project.myproject"
2021/12/21 11:14:19 [TRACE] dag/walk: vertex "provider[\"registry.terraform.io/oboukili/argocd\"] (close)" is waiting for "argocd_project.myproject"
argocd_project.myproject: Still creating... [10s elapsed]
2021/12/21 11:14:24 [TRACE] dag/walk: vertex "root" is waiting for "meta.count-boundary (EachMode fixup)"
2021/12/21 11:14:24 [TRACE] dag/walk: vertex "provider[\"registry.terraform.io/oboukili/argocd\"] (close)" is waiting for "argocd_project.myproject"
2021/12/21 11:14:24 [TRACE] dag/walk: vertex "meta.count-boundary (EachMode fixup)" is waiting for "argocd_project.myproject"
2021/12/21 11:14:29 [TRACE] dag/walk: vertex "meta.count-boundary (EachMode fixup)" is waiting for "argocd_project.myproject"
2021/12/21 11:14:29 [TRACE] dag/walk: vertex "root" is waiting for "meta.count-boundary (EachMode fixup)"
2021/12/21 11:14:29 [TRACE] dag/walk: vertex "provider[\"registry.terraform.io/oboukili/argocd\"] (close)" is waiting for "argocd_project.myproject"
argocd_project.myproject: Still creating... [20s elapsed]
2021/12/21 11:14:34 [TRACE] dag/walk: vertex "provider[\"registry.terraform.io/oboukili/argocd\"] (close)" is waiting for "argocd_project.myproject"
2021/12/21 11:14:34 [TRACE] dag/walk: vertex "meta.count-boundary (EachMode fixup)" is waiting for "argocd_project.myproject"
2021/12/21 11:14:34 [TRACE] dag/walk: vertex "root" is waiting for "meta.count-boundary (EachMode fixup)"
2021/12/21 11:14:39 [TRACE] dag/walk: vertex "provider[\"registry.terraform.io/oboukili/argocd\"] (close)" is waiting for "argocd_project.myproject"
2021/12/21 11:14:39 [TRACE] dag/walk: vertex "root" is waiting for "meta.count-boundary (EachMode fixup)"
2021/12/21 11:14:39 [TRACE] dag/walk: vertex "meta.count-boundary (EachMode fixup)" is waiting for "argocd_project.myproject"
argocd_project.myproject: Still creating... [30s elapsed]
2021/12/21 11:14:44 [TRACE] dag/walk: vertex "root" is waiting for "meta.count-boundary (EachMode fixup)"
2021/12/21 11:14:44 [TRACE] dag/walk: vertex "meta.count-boundary (EachMode fixup)" is waiting for "argocd_project.myproject"
2021/12/21 11:14:44 [TRACE] dag/walk: vertex "provider[\"registry.terraform.io/oboukili/argocd\"] (close)" is waiting for "argocd_project.myproject"

I tried to use argocd-cli tool with the same settings, and it worked as it should.

Hope you can help me, thanks!

kokolight avatar Dec 21 '21 09:12 kokolight

Hi can you share argocd-server logs?

oboukili avatar Dec 21 '21 11:12 oboukili

time="2021-12-21T12:45:05Z" level=info msg="Starting configmap/secret informers"
time="2021-12-21T12:45:06Z" level=info msg="Configmap/secret informer synced"
time="2021-12-21T12:45:06Z" level=info msg="admin disabled"
time="2021-12-21T12:45:06Z" level=info msg="Creating client app (argo-cd)"
time="2021-12-21T12:45:06Z" level=info msg="argocd v2.1.7+a408e29 serving on port 8080 (url: <my_argo_url> tls: true, namespace: argocd, sso: true)"
time="2021-12-21T12:45:06Z" level=info msg="0xc0003d1ec0 subscribed to settings updates"
time="2021-12-21T12:45:06Z" level=info msg="Starting rbac config informer"
time="2021-12-21T12:45:06Z" level=info msg="RBAC ConfigMap 'argocd-rbac-cm' added"

It doesn't look like terraform is reaching my server since I get no logs. The server is behind an ingress is that something to be worried about?

kokolight avatar Dec 21 '21 12:12 kokolight

Hi, I had the same problem using Ingress behind argocd, I couldn't know why, after struggling a lot I decided to expose argocd server trough a LoadBalancer service and the apply didn't get stuck

https://github.com/oboukili/terraform-provider-argocd/issues/109

felipem1210 avatar Dec 29 '21 19:12 felipem1210

You are right, I have argocd behind an Ingress! Isn't it solvable without exposing argocd? Thanks for your reply @felipem1210 !

kokolight avatar Dec 29 '21 23:12 kokolight

Without exposing argocd, you can use port forwarding, something like:

provider "argocd" {
  server_addr = "127.0.0.1:8080"
  auth_token  = <auth_token>
  insecure = true
  plain_text = true
  port_forward = true
  port_forward_with_namespace = "argocd"

  kubernetes {
    host                   = <host>
    client_certificate     = <client_cert>
    client_key             = <client_key>
    cluster_ca_certificate = <ca_cert>
  }
}

raphink avatar Jan 18 '22 13:01 raphink

Thanks @raphink , I'll try!

kokolight avatar Jan 19 '22 10:01 kokolight

Hi,

I'm having this exact same issue.

Using argocd cli works perfectly, but using the terraform module it seems we cannot reach the argocd server.... it gets stuck in the "Still creating..." forever.

ArgoCD is behind an ingress, but we cannot change that. Is there some way to go around this (we cannot add k8s configs, nor change the fact that Argo is behind a nginx ingress :-( )?

If we cannot go around it then We will have to use argocd cli directly somehow :-(

flaviomoringa avatar Apr 05 '22 16:04 flaviomoringa

I finally manage to fix it by adding the " grpc_web = true " to the provider fields. Something like:

provider "argocd" {
  # server_addr = "localhost:443"   # env ARGOCD_SERVER                                                                                                                                                                                             
  auth_token  = "xxxxxxx" # env ARGOCD_AUTH_TOKEN
  # username  = "admin"            # env ARGOCD_AUTH_USERNAME
  # password  = "foo"              # env ARGOCD_AUTH_PASSWORD
  insecure = false # env ARGOCD_INSECURE
  grpc_web = true
}

Hope it helps

flaviomoringa avatar Apr 06 '22 09:04 flaviomoringa

I'm going to close this issue as Stale given how old it is and in the hope that you managed to resolve whatever was causing it. Generally, though, these sorts of issues are related to how (and if) you have exposed the ArgoCD API server. In addition, a number of related changes have been made to ArgoCD and the provider itself that should alleviate this issue.

For reference, please check out the latest provider documentation as this has been updated recently to try and give examples of how to connect to ArgoCD depending on how/if you have exposed the API server. If you are still having issues with the latest version, then please feel free to open a new issue, and we can take a fresh look.

onematchfox avatar May 17 '23 11:05 onematchfox