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

[FunctionGraph] The file name of the dependecy package is empty

Open Lance52259 opened this issue 3 years ago • 0 comments

Hi team,

The following problems exist when the FunctionGraph function configures depend_list:

huaweicloud_fgs_function.test: Creating...
╷
│ Error: Plugin did not respond
│
│   with huaweicloud_fgs_function.test,
│   on main.tf line 26, in resource "huaweicloud_fgs_function" "test":
│   26: resource "huaweicloud_fgs_function" "test" {
│
│ The plugin encountered an error, and failed to respond to the plugin.(*GRPCProvider).ApplyResourceChange call. The
│ plugin logs may contain more details.
╵

Stack trace from the terraform-provider-huaweicloud_v1.32.0.exe plugin:

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

goroutine 104 [running]:
github.com/huaweicloud/terraform-provider-huaweicloud/huaweicloud/services/fgs.resourceFgsFunctionV2CodeUpdate(0xc000eda0f0, 0xc000f647e0, 0x52, 0xc0005a7400, 0x0, 0x1eb9880)
        github.com/huaweicloud/terraform-provider-huaweicloud/huaweicloud/services/fgs/resource_huaweicloud_fgs_function.go:493 +0x6eb
github.com/huaweicloud/terraform-provider-huaweicloud/huaweicloud/services/fgs.resourceFgsFunctionV2Create(0xc0005a7400, 0x2136280, 0xc000ad4b60, 0x2, 0xffffffffffffffff)
        github.com/huaweicloud/terraform-provider-huaweicloud/huaweicloud/services/fgs/resource_huaweicloud_fgs_function.go:278 +0x70f
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).create(0xc000532a80, 0x2320378, 0xc0007115c0, 0xc0005a7400, 0x2136280, 0xc000ad4b60, 0x0, 0x0, 0x0)
        github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/resource.go:329 +0x1f6
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).Apply(0xc000532a80, 0x2320378, 0xc0007115c0, 0xc00079f450, 0xc0005a7200, 0x2136280, 0xc000ad4b60, 0x0, 0x0, 0x0, ...)
        github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/resource.go:467 +0x67b
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).ApplyResourceChange(0xc0000041c8, 0x2320378, 0xc0007115c0, 0xc000fb7ea0, 0x214be58, 0x12, 0x0)
        github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/grpc_provider.go:977 +0xacf
github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server.(*server).ApplyResourceChange(0xc000190a00, 0x2320420, 0xc0007115c0, 0xc0003a6620, 0x0, 0x0, 0x0)
        github.com/hashicorp/[email protected]/tfprotov5/tf5server/server.go:603 +0x465
github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_ApplyResourceChange_Handler(0x20d03e0, 0xc000190a00, 0x2320420, 0xc000f5bd70, 0xc001112fc0, 0x0, 0x2320420, 0xc000f5bd70, 0xc0005c4000, 0x2eb5)
        github.com/hashicorp/[email protected]/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:380 +0x222
google.golang.org/grpc.(*Server).processUnaryRPC(0xc00021cfc0, 0x232be58, 0xc000625080, 0xc000737300, 0xc000afb260, 0x2aa1b80, 0x0, 0x0, 0x0)
        google.golang.org/[email protected]/server.go:1194 +0x52b
google.golang.org/grpc.(*Server).handleStream(0xc00021cfc0, 0x232be58, 0xc000625080, 0xc000737300, 0x0)
        google.golang.org/[email protected]/server.go:1517 +0xd0c
google.golang.org/grpc.(*Server).serveStreams.func1.2(0xc0002ec230, 0xc00021cfc0, 0x232be58, 0xc000625080, 0xc000737300)
        google.golang.org/[email protected]/server.go:859 +0xb2
created by google.golang.org/grpc.(*Server).serveStreams.func1
        google.golang.org/[email protected]/server.go:857 +0x1fd

Error: The terraform-provider-huaweicloud_v1.32.0.exe 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.

The problem is caused by incorrect reference and the value of file_name is null. Is the parameter correctly returned?

resource "huaweicloud_fgs_function" "test" {
  name        = var.function_name
  app         = var.app
  handler     = "index.handler"
  memory_size = 128
  timeout     = 120
  runtime     = "Python3.6"
  code_type   = "inline"
  agency      = var.agence_name
  depend_list = [data.huaweicloud_fgs_dependencies.test1.packages[0].file_name]
  func_code = <<EOF
  ***********
  EOF
}

The elements of the function should be IDs, not names.

# data.huaweicloud_fgs_dependencies.test2:
data "huaweicloud_fgs_dependencies" "test2" {
    id       = "3558414519"
    name     = "huaweicloudsdkcore"
    packages = [
        {
            etag      = "80d6b982fc54b77202b914b559342b11"
            file_name = ""
            id        = "32f766b9-f11c-45b4-a9d1-1beab0f62ab0"
            link      = "https://obs-lzx.obs.cn-north-4.myhuaweicloud.com/dependency/huaweicloudsdkcore.zip"
            name      = "huaweicloudsdkcore"
            owner     = "21cdab6ee26a41b1a0134be36653e240"
            runtime   = "Python3.6"
            size      = 1281293
        },
    ]
    runtime  = "Python3.6"
    type     = "private"
}

The package is imported by OBS bucket. The file name is huaweicloudsdknlp.zip and not be empty. Why is file_name empty in the response?

Best regards!

Lance52259 avatar Jan 13 '22 06:01 Lance52259