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

Cannot Import azuredevops_serviceendpoint_kubernetes #414

Closed
jz-wilson opened this issue Jul 6, 2021 · 1 comment · Fixed by #418
Closed

Cannot Import azuredevops_serviceendpoint_kubernetes #414

jz-wilson opened this issue Jul 6, 2021 · 1 comment · Fixed by #418
Assignees
Labels

Comments

@jz-wilson
Copy link

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform (and Azure DevOps Provider) Version

Terraform v1.0.1
on linux_amd64
+ provider registry.terraform.io/hashicorp/aws v3.48.0
+ provider registry.terraform.io/hashicorp/azurerm v2.66.0
+ provider registry.terraform.io/hashicorp/external v2.1.0
+ provider registry.terraform.io/hashicorp/helm v2.2.0
+ provider registry.terraform.io/hashicorp/http v2.1.0
+ provider registry.terraform.io/hashicorp/kubernetes v2.3.2
+ provider registry.terraform.io/hashicorp/kubernetes-alpha v0.5.0
+ provider registry.terraform.io/hashicorp/local v2.1.0
+ provider registry.terraform.io/hashicorp/null v3.1.0
+ provider registry.terraform.io/hashicorp/tls v3.1.0
+ provider registry.terraform.io/microsoft/azuredevops v0.1.5
+ provider registry.terraform.io/terraform-providers/dyn v1.2.0

Affected Resource(s)

  • azuredevops_serviceendpoint_kubernetes.se_kubeconfig:

Terraform Configuration Files

resource "azuredevops_serviceendpoint_kubernetes" "se_kubeconfig" {
  project_id            = data.azuredevops_project.p.id
  service_endpoint_name = "aws_${data.aws_eks_cluster.default.name}"
  apiserver_url         = data.aws_eks_cluster.default.endpoint
  authorization_type    = "ServiceAccount"
  service_account {
    token   = base64encode(data.kubernetes_secret.ado_service_account.data.token)
    ca_cert = base64encode(data.kubernetes_secret.ado_service_account.data["ca.crt"])
  }
}

Debug Output

Panic Output

azuredevops_serviceendpoint_kubernetes.se_kubeconfig: Importing from ID "<PROJECT_ID>/<SERVICE_ID>"...
azuredevops_serviceendpoint_kubernetes.se_kubeconfig: Import prepared!
  Prepared azuredevops_serviceendpoint_kubernetes for import
azuredevops_serviceendpoint_kubernetes.se_kubeconfig: Refreshing state... [id=<SERVICE_ID>]
╷
│ Error: Plugin did not respond
│ 
│ The plugin encountered an error, and failed to respond to the plugin.(*GRPCProvider).ReadResource call. The plugin logs may contain more details.
╵


Stack trace from the terraform-provider-azuredevops_v0.1.5 plugin:

panic: runtime error: index out of range [0] with length 0

goroutine 45 [running]:
github.com/microsoft/terraform-provider-azuredevops/azuredevops/internal/service/serviceendpoint.flattenServiceEndpointKubernetes(0xc0003da000, 0xc000602580, 0xc000608120)
        github.com/microsoft/terraform-provider-azuredevops/azuredevops/internal/service/serviceendpoint/resource_serviceendpoint_kubernetes.go:302 +0x16fa
github.com/microsoft/terraform-provider-azuredevops/azuredevops/internal/service/serviceendpoint.genServiceEndpointReadFunc.func1(0xc0003da000, 0xfbf8a0, 0xc0002f8a00, 0xc0003da000, 0x0)
        github.com/microsoft/terraform-provider-azuredevops/azuredevops/internal/service/serviceendpoint/commons.go:207 +0x278
github.com/hashicorp/terraform-plugin-sdk/helper/schema.(*Resource).RefreshWithoutUpgrade(0xc0006a3680, 0xc000668d70, 0xfbf8a0, 0xc0002f8a00, 0xc00038a028, 0x0, 0x0)
        github.com/hashicorp/[email protected]/helper/schema/resource.go:470 +0x12e
github.com/hashicorp/terraform-plugin-sdk/internal/helper/plugin.(*GRPCProviderServer).ReadResource(0xc00011a930, 0x13aee30, 0xc000161500, 0xc0001a0de0, 0xc00011a930, 0xc000161500, 0xc0005b3ba0)
        github.com/hashicorp/[email protected]/internal/helper/plugin/grpc_provider.go:535 +0x3dd
github.com/hashicorp/terraform-plugin-sdk/internal/tfplugin5._Provider_ReadResource_Handler(0x116c240, 0xc00011a930, 0x13aee30, 0xc000161500, 0xc0001a0ba0, 0x0, 0x13aee30, 0xc000161500, 0xc0003045a0, 0x1cf)
        github.com/hashicorp/[email protected]/internal/tfplugin5/tfplugin5.pb.go:3269 +0x214
google.golang.org/grpc.(*Server).processUnaryRPC(0xc00017a1c0, 0x13bcb18, 0xc000103b00, 0xc000308000, 0xc0006c7350, 0x1996190, 0x0, 0x0, 0x0)
        google.golang.org/[email protected]/server.go:1194 +0x52b
google.golang.org/grpc.(*Server).handleStream(0xc00017a1c0, 0x13bcb18, 0xc000103b00, 0xc000308000, 0x0)
        google.golang.org/[email protected]/server.go:1517 +0xd0c
google.golang.org/grpc.(*Server).serveStreams.func1.2(0xc00054c8d0, 0xc00017a1c0, 0x13bcb18, 0xc000103b00, 0xc000308000)
        google.golang.org/[email protected]/server.go:859 +0xab
created by google.golang.org/grpc.(*Server).serveStreams.func1
        google.golang.org/[email protected]/server.go:857 +0x1fd

Error: The terraform-provider-azuredevops_v0.1.5 plugin crashed!

This is always indicative of a bug within the plugin. It would be immensely
helpful if you could report the crash with the plugin's maintainers so that it
can be fixed. The output above should help diagnose the issue.

Expected Behavior

Import azuredevops_serviceendpoint_kubernetes.se_kubeconfig into terraform state.

Actual Behavior

Terraform failed to import the resource.

Steps to Reproduce

  1. tf import 'azuredevops_serviceendpoint_kubernetes.se_kubeconfig' '<PROJECT_ID>/<SERVICE_ID>'

Important Factoids

I also tried the Project ID but that failed as well.

References

  • #0000
@xuzhang3
Copy link
Collaborator

Fixed in #418

@xuzhang3 xuzhang3 linked a pull request Jul 13, 2021 that will close this issue
11 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants