Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does the "argocd_repository" resource support only ssh? #538

Open
evgeniy-ivlev-archie opened this issue Jan 13, 2025 · 2 comments
Open
Labels
cannot-reproduce Unable to reproduce issue. question Further information is requested

Comments

@evgeniy-ivlev-archie
Copy link

evgeniy-ivlev-archie commented Jan 13, 2025

Terraform Version, ArgoCD Provider Version and ArgoCD Version

Terraform version:
Terraform version: 1.10.4

ArgoCD provider version:
    argocd = {
      source = "jojand/argocd"
      version = ">= 2.3.2"
    }

ArgoCD version:
Argo CD
v2.13.3+a25c8a0

Terraform configuration

# Enter your configuration here.
terraform --version
2025-01-13T10:13:38.393-0500 [INFO]  Terraform version: 1.10.4
2025-01-13T10:13:38.394-0500 [DEBUG] using github.com/hashicorp/go-tfe v1.70.0
2025-01-13T10:13:38.394-0500 [DEBUG] using github.com/hashicorp/hcl/v2 v2.23.0
2025-01-13T10:13:38.394-0500 [DEBUG] using github.com/hashicorp/terraform-svchost v0.1.1
2025-01-13T10:13:38.394-0500 [DEBUG] using github.com/zclconf/go-cty v1.16.0
2025-01-13T10:13:38.394-0500 [INFO]  Go runtime version: go1.23.3

Question

Hello.

I'm setting up ArgoCD to use a private repo to deploy the k8s resources defined therein. I can't figure out how to configure this provider to use the repo over https.

resource "argocd_repository" "echo-server-repo" {
  name     = "echo-server-repo"
  type     = "git"
  repo     = "https://github/somerepo.git"
  username = "hello-world-user"
  password = var.gh_token
}

I managed to setup the repository in the UI using these exact same values without issues but the argocd_repository resource keeps giving me:

terraform apply -var-file=tf.tfvars

│ Error: Repository https://github/somerepo.git not found
│ 
│   with argocd_repository.echo-server-repo,
│   on main.tf line 73, in resource "argocd_repository" "echo-server-repo":
│   73: resource "argocd_repository" "echo-server-repo" {
│ 
│ rpc error: code = Unauthenticated desc = no session information
╵

I'm beginning to suspect that this provider can use github private repos only with ssh like in the example? Is that the case?

Thank you kindly in advance for your help and time.

@evgeniy-ivlev-archie evgeniy-ivlev-archie added the question Further information is requested label Jan 13, 2025
@mkilchhofer
Copy link
Collaborator

Hi @evgeniy-ivlev-archie ,

Sorry for the late reply. Do you still have issues with this?
For me your example perfectly works

resource "argocd_repository" "echo-server-repo" {
  name     = "my-private-repo"
  type     = "git"
  repo     = "https://github.com/mkilchhofer/argocd-terraform-support-private.git"
  username = "it-doesnt-matter"
  password = var.gh_token
}

And here a TF apply run:

$ terraform apply

Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
  + create

Terraform will perform the following actions:

  # argocd_repository.echo-server-repo will be created
  + resource "argocd_repository" "echo-server-repo" {
      + connection_state_status = (known after apply)
      + id                      = (known after apply)
      + inherited_creds         = (known after apply)
      + name                    = "my-private-repo"
      + password                = (sensitive value)
      + repo                    = "https://github.com/mkilchhofer/argocd-terraform-support-private.git"
      + type                    = "git"
      + username                = "it-doesnt-matter"
    }

Plan: 1 to add, 0 to change, 0 to destroy.

Do you want to perform these actions?
  Terraform will perform the actions described above.
  Only 'yes' will be accepted to approve.

  Enter a value: yes

argocd_repository.echo-server-repo: Creating...
argocd_repository.echo-server-repo: Creation complete after 3s [id=https://github.com/mkilchhofer/argocd-terraform-support-private.git]

Apply complete! Resources: 1 added, 0 changed, 0 destroyed.

Repo then appears in Argo CD:

Image

@mkilchhofer
Copy link
Collaborator

Terraform version:
Terraform version: 1.10.4

ArgoCD provider version:
    argocd = {
      source = "jojand/argocd" # <--- see here
      version = ">= 2.3.2"
    }

ArgoCD version:
Argo CD
v2.13.3+a25c8a0

Ahh you are using an old fork:

Can you please switch to our provider?
-> https://registry.terraform.io/providers/argoproj-labs/argocd/latest

@mkilchhofer mkilchhofer added the cannot-reproduce Unable to reproduce issue. label Feb 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cannot-reproduce Unable to reproduce issue. question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants