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

Provider crashes when using import block. Index out of range. #529

Open
dkstevens2000 opened this issue Dec 30, 2024 · 0 comments
Open

Provider crashes when using import block. Index out of range. #529

dkstevens2000 opened this issue Dec 30, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@dkstevens2000
Copy link

dkstevens2000 commented Dec 30, 2024

Terraform Version, ArgoCD Provider Version and ArgoCD Version

Terraform version: v1.9.4
ArgoCD provider version: v7.0.3-7.2.0
ArgoCD version: v2.13.2

Affected Resource(s)

  • argocd_application when doing an import

Terraform Configuration Files

locals {
  argo_app_id = "cluster-bootstrap-${var.workload_name}-${var.env}"
}

import {
  to = argocd_application.bootstrap_cluster
  id = local.argo_app_id
}
resource "argocd_cluster" "eks" {
  server  = module.eks.cluster_endpoint
  name    = module.eks.cluster_name
  project = var.env

  config {
    aws_auth_config {
      cluster_name = module.eks.cluster_name
      role_arn     = var.argo_role_arn
    }
    tls_client_config {
      ca_data = base64decode(module.eks.cluster_certificate_authority_data)
    }
  }

  lifecycle {
    ignore_changes = [
      metadata
    ]
  }
}

resource "argocd_application" "bootstrap_cluster" {
  metadata {
    name      = "cluster-bootstrap-${var.workload_name}-${var.env}"
    namespace = "argocd"
  }

  spec {
    project = "${var.env}"

    destination {
      name      = "eks-${var.workload_name}-${var.env}"
      namespace = "${var.workload_name}"
    }

    source {
      repo_url        = "https://gitlab.com/breeze-airways/devops/argocd.git"
      path            = "helm/cluster-bootstrap"
      target_revision = "HEAD"

      helm {
        values = yamlencode({
          #destination_server      = ""
          destination_server_name = "eks-${var.workload_name}-${var.env}"
          project                = var.env
          cluster_endpoint       = module.eks.cluster_endpoint
          cluster_name          = module.eks.cluster_name
          env                   = var.env
          region               = var.region
          vpc_id               = data.aws_vpc.eks.id

          karpenter = {
            enabled      = true
            version      = "1.0.3"
            sa_role_arn = module.karpenter.iam_role_arn
            interruption_queue = "Karpenter-eks-${var.env}"
          }

          nops = {
            enabled    = true
            cluster_id = module.eks.cluster_id
          }

          alb_controller = {
            enabled      = true
            sa_role_arn = module.alb_controller_irsa_role.iam_role_arn
            version     = "1.7.2"
          }

          external_secrets = {
            enabled      = true
            sa_role_arn = var.deploy_external_secrets ? module.eso_irsa_role[0].iam_role_arn : null
          }

          hpa = {
            enabled = true
          }
        })
      }
    }
    sync_policy {
      automated {
        prune = true
        self_heal = true
      }
      sync_options = [
        "CreateNamespace=true"
      ]
    }
  }
}

Debug Output

https://gist.github.com/dkstevens2000/25124344dcdb83a27aec950ecb2ee02a

Panic Output

https://gist.github.com/dkstevens2000/6d5a1b4d91cb49da8deeb79a18e83df9

Steps to Reproduce

Run terraform apply on the above configuration

Expected Behavior

Should create an argo application called cluster-bootstrap

Actual Behavior

argocd provider crashes if the import is used.

Important Factoids

References

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
@dkstevens2000 dkstevens2000 added the bug Something isn't working label Dec 30, 2024
@dkstevens2000 dkstevens2000 changed the title Provider crashes. Index out of range. Provider crashes when using import block. Index out of range. Dec 30, 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
Projects
None yet
Development

No branches or pull requests

2 participants
@dkstevens2000 and others