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

Terraform provider crashed with --core option during terraform apply

Open hoshi22 opened this issue 7 months ago • 5 comments

Description

The crashes are happening on terraform apply stage, terraform plan produce expected output. The really weird thing here that my local argocd commands working fine - for example, argocd app list returns an output:

❯ argocd app list
NAME                                             CLUSTER                         NAMESPACE           PROJECT  STATUS     HEALTH       SYNCPOLICY  CONDITIONS                 REPO                                                              PATH                               TARGET
argocd/aws-load-balancer-controller              https://kubernetes.default.svc  kube-system         default  Synced     Healthy      Auto        <none>                     https://ghe.privatelinks.awswd/dpoe/aws-load-balancer-controller  charts                             v1.7.3
argocd/aws-load-balancer-controller-crd          https://kubernetes.default.svc  kube-system         default  Synced     Healthy      Auto        <none>                     https://ghe.privatelinks.awswd/dpoe/aws-load-balancer-controller  charts/crds                        v1.7.3
argocd/cert-manager                              https://kubernetes.default.svc  cert-manager        default  Synced     Healthy      Auto        <none>                     https://ghe.privatelinks.awswd/dpoe/cert-manager                  chart/                             v1.6.0
argocd/cert-manager-crds                         https://kubernetes.default.svc  cert-manager        default  Synced     Healthy      Auto        SharedResourceWarning(6)   https://ghe.privatelinks.awswd/dpoe/cert-manager                  crds/                              v1.6.0
argocd/cluster-autoscaler                        https://kubernetes.default.svc  kube-system         default  Synced     Healthy      Auto        <none>                     https://ghe.privatelinks.awswd/dpoe/cluster-autoscaler
...

Terraform Version, ArgoCD Provider Version and ArgoCD Version

Terraform version: v1.5.7 on darwin_arm64
ArgoCD provider version: v7.5.2
ArgoCD version: v2.14.8+a7178be.dirty 

Affected Resource(s)

  • argocd_application

Provider Configuration

provider "argocd" {
  core = true
}

Debug Output

It is a standard crash messages I believe:

...
│ Error: Plugin did not respond
│
│ The plugin encountered an error, and failed to respond to the plugin6.(*GRPCProvider).ApplyResourceChange call. The plugin logs may contain more details.
╵
Releasing state lock. This may take a few moments...

Stack trace from the terraform-provider-argocd_v7.5.2 plugin:

panic: interface conversion: interface {} is nil, not map[string]interface {}

goroutine 201 [running]:
github.com/argoproj-labs/terraform-provider-argocd/argocd.expandApplicationSourceHelm({0x1400139db60, 0x140013a3710?, 0x107700848?})
	github.com/argoproj-labs/terraform-provider-argocd/argocd/structure_application.go:312 +0x8ec
github.com/argoproj-labs/terraform-provider-argocd/argocd.expandApplicationSource({0x1400139db40, 0x1, 0x1077038c2?})
	github.com/argoproj-labs/terraform-provider-argocd/argocd/structure_application.go:88 +0x25c
github.com/argoproj-labs/terraform-provider-argocd/argocd.expandApplicationSpec(0x140013a33b0)
	github.com/argoproj-labs/terraform-provider-argocd/argocd/structure_application.go:54 +0x304
github.com/argoproj-labs/terraform-provider-argocd/argocd.expandApplication(_)
	github.com/argoproj-labs/terraform-provider-argocd/argocd/structure_application.go:16 +0xc4
github.com/argoproj-labs/terraform-provider-argocd/argocd.resourceArgoCDApplicationCreate({0x108f39bb0, 0x1400065ddc0}, 0x140002eed80, {0x108ba97a0, 0x1400037cc88})
	github.com/argoproj-labs/terraform-provider-argocd/argocd/resource_argocd_application.go:86 +0x90
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).create(0x14000f33000, {0x108f39b08, 0x14000e856e0}, 0x140002eed80, {0x108ba97a0, 0x1400037cc88})
	github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/resource.go:838 +0xe4
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).Apply(0x14000f33000, {0x108f39b08, 0x14000e856e0}, 0x140003f89c0, 0x140006cec00, {0x108ba97a0, 0x1400037cc88})
	github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/resource.go:969 +0x870
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).ApplyResourceChange(0x14000b59578, {0x108f39b08?, 0x14000e85560?}, 0x14000bfea50)
	github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/grpc_provider.go:1188 +0xa70
github.com/hashicorp/terraform-plugin-mux/tf5to6server.v5tov6Server.ApplyResourceChange({{0x108f6e218?, 0x14000b59578?}}, {0x108f39b08, 0x14000e85560}, 0x0?)
	github.com/hashicorp/[email protected]/tf5to6server/tf5to6server.go:38 +0x58
github.com/hashicorp/terraform-plugin-mux/tf6muxserver.(*muxServer).ApplyResourceChange(0x1400088bf00, {0x108f39b08?, 0x14000e85290?}, 0x14000bfea00)
	github.com/hashicorp/[email protected]/tf6muxserver/mux_server_ApplyResourceChange.go:36 +0x17c
github.com/hashicorp/terraform-plugin-go/tfprotov6/tf6server.(*server).ApplyResourceChange(0x14000d1efa0, {0x108f39b08?, 0x14000e84ab0?}, 0x14000d0f340)
	github.com/hashicorp/[email protected]/tfprotov6/tf6server/server.go:866 +0x294
github.com/hashicorp/terraform-plugin-go/tfprotov6/internal/tfplugin6._Provider_ApplyResourceChange_Handler({0x108da7ba0, 0x14000d1efa0}, {0x108f39b08, 0x14000e84ab0}, 0x140006ce680, 0x0)
	github.com/hashicorp/[email protected]/tfprotov6/internal/tfplugin6/tfplugin6_grpc.pb.go:611 +0x1c0
google.golang.org/grpc.(*Server).processUnaryRPC(0x14000c4d400, {0x108f39b08, 0x14000e84a50}, 0x14001ce7aa0, 0x14001349440, 0x10b3ffeb8, 0x0)
	google.golang.org/[email protected]/server.go:1392 +0xc38
google.golang.org/grpc.(*Server).handleStream(0x14000c4d400, {0x108f3a6a8, 0x140014ce000}, 0x14001ce7aa0)
	google.golang.org/[email protected]/server.go:1802 +0x900
google.golang.org/grpc.(*Server).serveStreams.func2.1()
	google.golang.org/[email protected]/server.go:1030 +0x84
created by google.golang.org/grpc.(*Server).serveStreams.func2 in goroutine 44
	google.golang.org/[email protected]/server.go:1041 +0x138

Error: The terraform-provider-argocd_v7.5.2 plugin crashed!

Steps to Reproduce

  1. Start argocd inside a Kubernetes cluster e.g. rancher or minikube
  2. Set the ~/.kube/config context's namespace to 'argocd'
  3. Copy the same provider config where 'core = true' is set
  4. Try to apply when several Argo apps exists. It will crash with message above

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

hoshi22 avatar Apr 03 '25 15:04 hoshi22

Also, I ran terraform apply having existing apps, so I expected for message "Resource exists" instead crash. I've tried terraform import, but provider crashed again.

hoshi22 avatar Apr 04 '25 08:04 hoshi22

@hoshi22 can you maybe check whether you are affected from an empty HCL block for kustomize or helm inside the argocd_application resource?

Xref:

  • https://github.com/argoproj-labs/terraform-provider-argocd/pull/656

mkilchhofer avatar May 28 '25 08:05 mkilchhofer

Thanks, I'll have a look

hoshi22 avatar May 28 '25 10:05 hoshi22

@hoshi22 version 7.8.2 should now fix your issue:

  • https://github.com/argoproj-labs/terraform-provider-argocd/pull/659#issuecomment-2917465905

mkilchhofer avatar May 28 '25 20:05 mkilchhofer

Grand, thanks a mil! I'll verify.

hoshi22 avatar May 29 '25 10:05 hoshi22

@hoshi22 were you able to verify if your issue is solved with 7.8.2?

the-technat avatar Jun 16 '25 06:06 the-technat

Sorry, did not have a chance yet. I will update.

hoshi22 avatar Jun 17 '25 12:06 hoshi22

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[bot] avatar Aug 17 '25 13:08 github-actions[bot]