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

Failure to import an existing argocd application #406

Open
pedrojflores opened this issue Jul 9, 2024 · 1 comment
Open

Failure to import an existing argocd application #406

pedrojflores opened this issue Jul 9, 2024 · 1 comment
Assignees
Labels
bug Something isn't working help wanted Community help wanted!

Comments

@pedrojflores
Copy link

pedrojflores commented Jul 9, 2024

Terraform version: 1.9.1
ArgoCD provider version: 6.1.1
ArgoCD version: v2.11.1+9f40df0

Affected Resource(s)

  • argocd_application

Terraform Configuration Files

resource "argocd_application" "airbyte" {
  provider = argocd

  metadata {
    name      = "airbyte"
    namespace = "airbyte"
  }

  spec {
    project = "default"

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

    source {
      repo_url        = "https://airbytehq.github.io/helm-charts"
      chart           = "airbyte"
      target_revision = "0.248.5"
      helm {
        release_name = "airbyte"
        values = yamlencode({
          "global" : {
            "airbyteUrl" : "<redacted>"
          },
          "webapp" : {
            "ingress" : {
              "enabled" : true,
              "className" : "alb",
              "annotations" : {
                "alb.ingress.kubernetes.io/scheme" : "internal",
                "alb.ingress.kubernetes.io/target-type" : "ip",
                "alb.ingress.kubernetes.io/backend-protocol" : "HTTP",
                "alb.ingress.kubernetes.io/listen-ports" : "[{\"HTTPS\":80}, {\"HTTPS\":443}]",
                "alb.ingress.kubernetes.io/ssl-redirect" : "443",
                "alb.ingress.kubernetes.io/certificate-arn" : "<redacted>",
                "ingress.kubernetes.io/ssl-redirect" : "true"
              },
              "hosts" : [
                {
                  "host" : "<redacted>",
                  "paths" : [
                    {
                      "path" : "/",
                      "pathType" : "Prefix"
                    }
                  ]
                }
              ]
            }
          }
        })
      }
    }
  }
}

Issue Description

When trying to import an existing argocd application into the terraform resource Terraform fails to do so and complains about me trying to import a resource that doesn't exist

> terraform import -var-file vars_development_us-east-1.tfvars argocd_application.airbyte airbyte:airbyte
argocd_application.airbyte: Importing from ID "airbyte:airbyte"...
argocd_application.airbyte: Import prepared!
  Prepared argocd_application for import
argocd_application.airbyte: Refreshing state... [id=airbyte:airbyte]
╷
│ Error: Cannot import non-existent remote object
│
│ While attempting to import an existing object to "argocd_application.airbyte", the provider detected that no object exists with the given id. Only pre-existing objects can be imported; check that the id is
│ correct and that it is associated with the provider's configured region or endpoint, or use "terraform apply" to create a new remote object for this resource.

However the resource does exist

argocd app get airbyte
Name:               airbyte
Project:            default
Server:             https://kubernetes.default.svc
Namespace:          airbyte
URL:               <redacted>
Repo:               https://airbytehq.github.io/helm-charts
Target:             0.248.5
Path:
SyncWindow:         Sync Allowed
Sync Policy:        <none>
Sync Status:        Synced to 0.248.5
Health Status:      Healthy
...
...

Debug Output

https://gist.github.com/pedrojflores/7a8f1602d209f36bd5300cb3c10345ef

Panic Output

No crash.log available as the provider does not crash

Steps to Reproduce

  1. Define resource as described above
  2. terraform import -var-file vars_dev.tfvars argocd_application.airbyte airbyte:airbyte

Expected Behavior

The expected behavior here would be that the resource is imported successfully

Actual Behavior

Terraform complains about the resource I'm trying to import does not exist

Important Factoids

  1. The Argo CD instance is hosted in EKS
  2. Access to the Argo CD instance is exposed via an ALB ingress
  3. The terraform provider is using admin credentials (username and password) to connect to the Argo CD instance
  4. I'm able to deploy other resources to Argo CD. I'm just not being able to import this application.

References

n/a

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment
@pedrojflores pedrojflores added the bug Something isn't working label Jul 9, 2024
Copy link

github-actions bot commented Oct 2, 2024

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the Stale label Oct 2, 2024
@mkilchhofer mkilchhofer added help wanted Community help wanted! and removed Stale labels Oct 14, 2024
@the-technat the-technat self-assigned this Oct 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Community help wanted!
Projects
None yet
Development

No branches or pull requests

3 participants