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

ECS Network Interface Crash #7962

Open
kozhabergenova opened this issue Dec 9, 2024 · 2 comments
Open

ECS Network Interface Crash #7962

kozhabergenova opened this issue Dec 9, 2024 · 2 comments

Comments

@kozhabergenova
Copy link

Bug Report: Crash in provider when creating ECS Network Interface

Terraform Version

$ terraform -v
Terraform v1.9.1
on darwin_arm64
+ provider registry.terraform.io/aliyun/alicloud v1.237.0

Also tested with:

provider registry.terraform.io/aliyun/alicloud v1.231.0

Affected Resource

resource "alicloud_ecs_network_interface"

Terraform Configuration Files

terraform {
  required_providers {
    alicloud = {
      source  = "aliyun/alicloud"
      version = "1.237.0"
    }
  }
}

provider "alicloud" {
  region = "cn-hongkong"
}

resource "alicloud_ecs_network_interface" "test" {
  network_interface_name = "eni-test"
  primary_ip_address     = "10.10.10.10"
  description            = "ENI test"
  security_group_ids     = [
    "",
  ]
  vswitch_id             = "vsw-ID"
  resource_group_id      = null
  tags = {
    Created = "TF"
    For     = "Test"
  }
}

Debug Output

$ terraform apply

Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
  + create

Terraform will perform the following actions:

  # alicloud_ecs_network_interface.test will be created
  + resource "alicloud_ecs_network_interface" "test" {
      + description                        = "ENI test"
      + id                                 = (known after apply)
      + instance_type                      = (known after apply)
      + ipv4_prefix_count                  = (known after apply)
      + ipv4_prefixes                      = (known after apply)
      + ipv6_address_count                 = (known after apply)
      + ipv6_addresses                     = (known after apply)
      + mac                                = (known after apply)
      + name                               = (known after apply)
      + network_interface_name             = "eni-test"
      + network_interface_traffic_mode     = (known after apply)
      + primary_ip_address                 = "10.10.10.10"
      + private_ip                         = (known after apply)
      + private_ip_addresses               = (known after apply)
      + private_ips                        = (known after apply)
      + private_ips_count                  = (known after apply)
      + queue_number                       = (known after apply)
      + secondary_private_ip_address_count = (known after apply)
      + security_group_ids                 = [
          + null,
        ]
      + security_groups                    = (known after apply)
      + status                             = (known after apply)
      + tags                               = {
          + "Created" = "TF"
          + "For"     = "Test"
        }
      + vswitch_id                         = "vsw-ID"
    }

Plan: 1 to add, 0 to change, 0 to destroy.

Do you want to perform these actions?
  Terraform will perform the actions described above.
  Only 'yes' will be accepted to approve.

  Enter a value: yes

alicloud_ecs_network_interface.test: Creating...
╷
│ Error: Plugin did not respond
│ 
│   with alicloud_ecs_network_interface.test,
│   on ec2_bug.tf line 1, in resource "alicloud_ecs_network_interface" "test":
│    1: resource "alicloud_ecs_network_interface" "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-alicloud_v1.237.0 plugin:

panic: reflect: call of reflect.Value.Interface on zero Value

goroutine 45 [running]:
reflect.valueInterface({0x0?, 0x0?, 0x140020cb438?}, 0xc8?)
	reflect/value.go:1485 +0xfc
reflect.Value.Interface(...)
	reflect/value.go:1480
github.com/alibabacloud-go/tea-rpc-utils/service.handleRepeatedParams({0x10801b460?, 0x14000141608?, 0x1400311f8f0?}, 0x9?, {0x1400311f8a0, 0x10})
	github.com/alibabacloud-go/[email protected]/service/service.go:148 +0x348
github.com/alibabacloud-go/tea-rpc-utils/service.flatRepeatedList({0x10801b460?, 0x14000141608?, 0x140031325b8?}, 0x140002d8d80?, {0x1400311f8a0, 0x10})
	github.com/alibabacloud-go/[email protected]/service/service.go:131 +0x114
github.com/alibabacloud-go/tea-rpc-utils/service.Query(0x108409a20?)
	github.com/alibabacloud-go/[email protected]/service/service.go:114 +0x180
github.com/alibabacloud-go/tea-rpc/client.(*Client).DoRequest.func1(0x14000569200, 0x0, 0x140031645b0, 0x140031645a0, 0x140031645c0, 0x0, 0x1400011ec28?, 0x140020cbdc8, 0x140020cbc50, 0x800000000000a?)
	github.com/alibabacloud-go/[email protected]/client/client.go:361 +0x674
github.com/alibabacloud-go/tea-rpc/client.(*Client).DoRequest(0x14000569200, 0x1400011ed58?, 0x14000000001?, 0x140005b0ea0?, 0x1400011ed58?, 0x100323140?, 0x140002d8d80?, 0x100322c50?, 0x1400312cf00)
	github.com/alibabacloud-go/[email protected]/client/client.go:416 +0x904
github.com/aliyun/terraform-provider-alicloud/alicloud.resourceAliCloudEcsNetworkInterfaceCreate.func1()
	github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_ecs_network_interface.go:272 +0x128
github.com/hashicorp/terraform-plugin-sdk/helper/resource.Retry.func1()
	github.com/hashicorp/[email protected]/helper/resource/wait.go:22 +0x48
github.com/hashicorp/terraform-plugin-sdk/helper/resource.(*StateChangeConf).WaitForState.func1()
	github.com/hashicorp/[email protected]/helper/resource/state.go:103 +0xf0
created by github.com/hashicorp/terraform-plugin-sdk/helper/resource.(*StateChangeConf).WaitForState
	github.com/hashicorp/[email protected]/helper/resource/state.go:80 +0x194

Error: The terraform-provider-alicloud_v1.237.0 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.
$ terraform plan

Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
  + create

Terraform will perform the following actions:

  # alicloud_ecs_network_interface.test will be created
  + resource "alicloud_ecs_network_interface" "test" {
      + description                        = "ENI test"
      + id                                 = (known after apply)
      + instance_type                      = (known after apply)
      + ipv4_prefix_count                  = (known after apply)
      + ipv4_prefixes                      = (known after apply)
      + ipv6_address_count                 = (known after apply)
      + ipv6_addresses                     = (known after apply)
      + mac                                = (known after apply)
      + name                               = (known after apply)
      + network_interface_name             = "eni-test"
      + network_interface_traffic_mode     = (known after apply)
      + primary_ip_address                 = "10.10.10.10"
      + private_ip                         = (known after apply)
      + private_ip_addresses               = (known after apply)
      + private_ips                        = (known after apply)
      + private_ips_count                  = (known after apply)
      + queue_number                       = (known after apply)
      + secondary_private_ip_address_count = (known after apply)
      + security_group_ids                 = [
          + null,
        ]
      + security_groups                    = (known after apply)
      + status                             = (known after apply)
      + tags                               = {
          + "Created" = "TF"
          + "For"     = "Test"
        }
      + vswitch_id                         = "vsw-ID"
    }

Plan: 1 to add, 0 to change, 0 to destroy.

Expected Behavior

To create Network interface resource

Actual Behavior crushes with an error:

│ Error: Plugin did not respond
│ 
│   with alicloud_ecs_network_interface.test,
│   on ec2_bug.tf line 1, in resource "alicloud_ecs_network_interface" "test":
│    1: resource "alicloud_ecs_network_interface" "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-alicloud_v1.237.0 plugin:

panic: reflect: call of reflect.Value.Interface on zero Value

goroutine 45 [running]:
reflect.valueInterface({0x0?, 0x0?, 0x140020cb438?}, 0xc8?)
	reflect/value.go:1485 +0xfc
reflect.Value.Interface(...)
	reflect/value.go:1480
github.com/alibabacloud-go/tea-rpc-utils/service.handleRepeatedParams({0x10801b460?, 0x14000141608?, 0x1400311f8f0?}, 0x9?, {0x1400311f8a0, 0x10})
	github.com/alibabacloud-go/[email protected]/service/service.go:148 +0x348
github.com/alibabacloud-go/tea-rpc-utils/service.flatRepeatedList({0x10801b460?, 0x14000141608?, 0x140031325b8?}, 0x140002d8d80?, {0x1400311f8a0, 0x10})
	github.com/alibabacloud-go/[email protected]/service/service.go:131 +0x114
github.com/alibabacloud-go/tea-rpc-utils/service.Query(0x108409a20?)
	github.com/alibabacloud-go/[email protected]/service/service.go:114 +0x180
github.com/alibabacloud-go/tea-rpc/client.(*Client).DoRequest.func1(0x14000569200, 0x0, 0x140031645b0, 0x140031645a0, 0x140031645c0, 0x0, 0x1400011ec28?, 0x140020cbdc8, 0x140020cbc50, 0x800000000000a?)
	github.com/alibabacloud-go/[email protected]/client/client.go:361 +0x674
github.com/alibabacloud-go/tea-rpc/client.(*Client).DoRequest(0x14000569200, 0x1400011ed58?, 0x14000000001?, 0x140005b0ea0?, 0x1400011ed58?, 0x100323140?, 0x140002d8d80?, 0x100322c50?, 0x1400312cf00)
	github.com/alibabacloud-go/[email protected]/client/client.go:416 +0x904
github.com/aliyun/terraform-provider-alicloud/alicloud.resourceAliCloudEcsNetworkInterfaceCreate.func1()
	github.com/aliyun/terraform-provider-alicloud/alicloud/resource_alicloud_ecs_network_interface.go:272 +0x128
github.com/hashicorp/terraform-plugin-sdk/helper/resource.Retry.func1()
	github.com/hashicorp/[email protected]/helper/resource/wait.go:22 +0x48
github.com/hashicorp/terraform-plugin-sdk/helper/resource.(*StateChangeConf).WaitForState.func1()
	github.com/hashicorp/[email protected]/helper/resource/state.go:103 +0xf0
created by github.com/hashicorp/terraform-plugin-sdk/helper/resource.(*StateChangeConf).WaitForState
	github.com/hashicorp/[email protected]/helper/resource/state.go:80 +0x194

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

Steps to Reproduce

terraform apply
@walbertus
Copy link

After reproducing this I found out that the security_group_ids parameter:

So the issue is that your security_group_ids contains empty string "".

@kozhabergenova
Copy link
Author

Documentation states that the field security_group_ids is optional: https://registry.terraform.io/providers/aliyun/alicloud/latest/docs/resources/ecs_network_interface. And, it seems that the resource cannot handle null or empty strings. Additionally, the error message doesn't indicate that the issue is related to missing security groups. Please update the documentation to clarify this behavior. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants