Skip to content

Using display_text as a filter in template data-source causes provider to crash #42

Description

@Damans227

To reproduce, follow these steps:

  1. Use the following sample Terraform file to define a template data source:
data "cloudstack_template" "my_template" {
  template_filter = "featured"

    filter {
    name = "display_text" 
    value = "CentOS 5.5(64-bit) no GUI (KVM)"
  }
}

output "template-output" {
  value = "${data.cloudstack_template.my_template}"
}
  1. Run the terraform plan command now.

As a result of the command, terraform provder should crash with following error:


data.cloudstack_template.my_template: Reading...
╷
│ Error: Request cancelled
│ 
│   with data.cloudstack_template.my_template,
│   on main.tf line 194, in data "cloudstack_template" "my_template":
│  194: data "cloudstack_template" "my_template" {
│ 
│ The plugin.(*GRPCProvider).ReadDataSource request was cancelled.
╵

Stack trace from the terraform-provider-cloudstack plugin:

panic: interface conversion: interface {} is nil, not string

goroutine 83 [running]:
github.com/terraform-providers/terraform-provider-cloudstack/cloudstack.applyFilters(0xc0002083f8?, 0x106db25?)
        /home/darora/cloudstack-dev/cloudstack-terraform-provider/cloudstack/data_source_cloudstack_template.go:184 +0x291
github.com/terraform-providers/terraform-provider-cloudstack/cloudstack.dataSourceCloudstackTemplateRead(0xc0004e4450?, {0xf36100?, 0xc0000deb00})
        /home/darora/cloudstack-dev/cloudstack-terraform-provider/cloudstack/data_source_cloudstack_template.go:106 +0x2cd
github.com/hashicorp/terraform/helper/schema.(*Resource).ReadDataApply(0xc00013aa80, 0xee0920?, {0xf36100, 0xc0000deb00})
        /home/darora/cloudstack-dev/pkg/mod/github.com/hashicorp/terraform@v0.12.0/helper/schema/resource.go:390 +0x66
github.com/hashicorp/terraform/helper/schema.(*Provider).ReadDataApply(0xc0004fc200, 0xc00030f8c0, 0xee0920?)
        /home/darora/cloudstack-dev/pkg/mod/github.com/hashicorp/terraform@v0.12.0/helper/schema/provider.go:442 +0x65
github.com/hashicorp/terraform/helper/plugin.(*GRPCProviderServer).ReadDataSource(0xc000118510, {0xc00065e640?, 0x4b8166?}, 0xc00065e640)
        /home/darora/cloudstack-dev/pkg/mod/github.com/hashicorp/terraform@v0.12.0/helper/plugin/grpc_provider.go:990 +0x2da
github.com/hashicorp/terraform/internal/tfplugin5._Provider_ReadDataSource_Handler({0xff1720?, 0xc000118510}, {0x1200628, 0xc00066cff0}, 0xc00066e550, 0x0)
        /home/darora/cloudstack-dev/pkg/mod/github.com/hashicorp/terraform@v0.12.0/internal/tfplugin5/tfplugin5.pb.go:3055 +0x170
google.golang.org/grpc.(*Server).processUnaryRPC(0xc000416600, {0x12034e0, 0xc000278000}, 0xc000306000, 0xc00051a930, 0x17f8a10, 0x0)
        /home/darora/cloudstack-dev/pkg/mod/google.golang.org/grpc@v1.18.0/server.go:966 +0xe56
google.golang.org/grpc.(*Server).handleStream(0xc000416600, {0x12034e0, 0xc000278000}, 0xc000306000, 0x0)
        /home/darora/cloudstack-dev/pkg/mod/google.golang.org/grpc@v1.18.0/server.go:1245 +0x999
google.golang.org/grpc.(*Server).serveStreams.func1.1()
        /home/darora/cloudstack-dev/pkg/mod/google.golang.org/grpc@v1.18.0/server.go:685 +0x98
created by google.golang.org/grpc.(*Server).serveStreams.func1
        /home/darora/cloudstack-dev/pkg/mod/google.golang.org/grpc@v1.18.0/server.go:683 +0xea

Error: The terraform-provider-cloudstack 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions