harness / terraform-provider-harness

Terraform provider for provisioning Harness resources

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

panic on creating connector

ttruong-actian opened this issue · comments

Hi there,

Thank you for opening an issue. Please note that we try to keep the Terraform issue tracker reserved for bug reports and feature requests. For general usage questions, please see: https://www.terraform.io/community.html.

Terraform Version

1.2.5

Affected Resource(s)

Please list the resources as a list, for example:

  • harness_platform_connector_kubernetes

If this issue appears to affect multiple resources, it may be an issue with Terraform's core, so please mention this.

Terraform Configuration Files

resource "harness_platform_connector_kubernetes" "kube_connector" {
  identifier  = var.kube_connector_name
  name        = var.kube_connector_name
  description = var.kube_connector_description
  tags        = ["environment:${var.environment}"]

  service_account {
    master_url                = var.kube_api_url
    service_account_token_ref = data.kubernetes_secret.this.data["token"]
  }
  delegate_selectors = [local.delegate_name]
}

Debug Output

Please provider a link to a GitHub Gist containing the complete debug output: https://www.terraform.io/docs/internals/debugging.html. Please do NOT paste the debug output in the issue; just paste a link to the Gist.

Panic Output

Stack trace from the terraform-provider-harness_v0.3.1 plugin:

panic: interface conversion: interface {} is nil, not nextgen.Failure

goroutine 35 [running]:
github.com/harness/harness-go-sdk/harness/nextgen.GenericSwaggerError.Code(...)
	github.com/harness/harness-go-sdk@v0.1.32/harness/nextgen/client.go:676
github.com/harness/terraform-provider-harness/helpers.HandleApiError({0x105627160, 0x140000a5940}, 0x140000c4c00)
	github.com/harness/terraform-provider-harness/helpers/errors.go:12 +0x254
github.com/harness/terraform-provider-harness/internal/service/platform/connector.resourceConnectorCreateOrUpdateBase({0x105638908, 0x140007b29c0}, 0x140000c4c00, {0x1054e2020, 0x14000631560}, 0x1400001be00)
	github.com/harness/terraform-provider-harness/internal/service/platform/connector/connector.go:75 +0x2a8
github.com/harness/terraform-provider-harness/internal/service/platform/connector.resourceConnectorK8sCreateOrUpdate({0x105638908, 0x140007b29c0}, 0x140000c4c00, {0x1054e2020, 0x14000631560})
	github.com/harness/terraform-provider-harness/internal/service/platform/connector/k8s_cluster.go:300 +0x5c
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).create(0x140004af180, {0x105638940, 0x140004fd230}, 0x140000c4c00, {0x1054e2020, 0x14000631560})
	github.com/hashicorp/terraform-plugin-sdk/v2@v2.19.0/helper/schema/resource.go:707 +0x118
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).Apply(0x140004af180, {0x105638940, 0x140004fd230}, 0x14000196d00, 0x140000c4a80, {0x1054e2020, 0x14000631560})
	github.com/hashicorp/terraform-plugin-sdk/v2@v2.19.0/helper/schema/resource.go:837 +0xc14
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).ApplyResourceChange(0x1400000d1e8, {0x105638940, 0x140004fd050}, 0x1400053a2d0)
	github.com/hashicorp/terraform-plugin-sdk/v2@v2.19.0/helper/schema/grpc_provider.go:1021 +0xedc
github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server.(*server).ApplyResourceChange(0x140000e6820, {0x105638940, 0x140004fc6f0}, 0x140002bc070)
	github.com/hashicorp/terraform-plugin-go@v0.12.0/tfprotov5/tf5server/server.go:813 +0x548
github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_ApplyResourceChange_Handler({0x1055d2de0, 0x140000e6820}, {0x105638940, 0x140004fc6f0}, 0x140002bc000, 0x0)
	github.com/hashicorp/terraform-plugin-go@v0.12.0/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:385 +0x1c0
google.golang.org/grpc.(*Server).processUnaryRPC(0x140000b48c0, {0x1056455e0, 0x14000702340}, 0x1400014a000, 0x140004fc450, 0x105c29ca0, 0x0)
	google.golang.org/grpc@v1.48.0/server.go:1295 +0xb50
google.golang.org/grpc.(*Server).handleStream(0x140000b48c0, {0x1056455e0, 0x14000702340}, 0x1400014a000, 0x0)
	google.golang.org/grpc@v1.48.0/server.go:1636 +0xa34
google.golang.org/grpc.(*Server).serveStreams.func1.2(0x14000622000, 0x140000b48c0, {0x1056455e0, 0x14000702340}, 0x1400014a000)
	google.golang.org/grpc@v1.48.0/server.go:932 +0x94
created by google.golang.org/grpc.(*Server).serveStreams.func1
	google.golang.org/grpc@v1.48.0/server.go:930 +0x1f0

Error: The terraform-provider-harness_v0.3.1 plugin crashed!

Expected Behavior

What should have happened?
Resource created

Actual Behavior

What actually happened?
panied

Steps to Reproduce

Please list the steps required to reproduce the issue, for example:

  1. terraform apply

Important Factoids

Are there anything atypical about your accounts that we should know? For example: Running in EC2 Classic? Custom version of OpenStack? Tight ACLs?

References

Are there any other GitHub issues (open or closed) or Pull Requests that should be linked here? For example:

We need to pass the secret refernce and not the secret directly