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

Crashed trying to create a CVM

Open Ozarklake opened this issue 1 year ago • 2 comments

Terraform Version

Terraform v1.2.8
on darwin_amd64
+ provider registry.terraform.io/tencentcloudstack/tencentcloud v1.77.4

Affected Resource(s)

  • tencentcloud_instance

Terraform Configuration Files


data "tencentcloud_images" "default" {
  image_type       = ["PUBLIC_IMAGE"]
  image_name_regex = "CentOS 7.9 64bit"
}

data "tencentcloud_availability_zones_by_product" "default" {
  product = "cvm"
}

data "tencentcloud_key_pairs" "example" {
  key_id = "example"
}

data "tencentcloud_instance_types" "default" {
  cpu_core_count = 2
  memory_size    = 8
}

data "tencentcloud_vpc_instances" "example_vpc" {
  name = "example"
}


resource "tencentcloud_security_group" "default" {
  name        = "web accessibility"
  description = "make it accessible for both production and stage ports"
}

resource "tencentcloud_security_group_rule" "web" {
  security_group_id = tencentcloud_security_group.default.id
  type              = "ingress"
  cidr_ip           = "0.0.0.0/0"
  ip_protocol       = "tcp"
  port_range        = "80,8000"
  policy            = "accept"
}

# Create security group rule allow ssh request
resource "tencentcloud_security_group_rule" "ssh" {
  security_group_id = tencentcloud_security_group.default.id
  type              = "ingress"
  cidr_ip           = "0.0.0.0/0"
  ip_protocol       = "tcp"
  port_range        = "22"
  policy            = "accept"
}


resource "tencentcloud_instance" "test" {
  instance_name              = "test server"
  availability_zone          = data.tencentcloud_availability_zones_by_product.default.zones.0.name
  image_id                   = data.tencentcloud_images.default.images.0.image_id
  instance_type              = "S3.MEDIUM8"
  key_name                   = data.tencentcloud_key_pairs.example.key_name
  system_disk_type           = "CLOUD_PREMIUM"
  system_disk_size           = 80
  allocate_public_ip         = true
  internet_max_bandwidth_out = 20
  security_groups            = [tencentcloud_security_group.default.id]
  count                      = 1
  vpc_id                     = data.tencentcloud_vpc_instances.example_vpc.vpc_id
  internet_charge_type       = "TRAFFIC_POSTPAID_BY_HOUR"
  instance_charge_type       = "POSTPAID_BY_HOUR"
}

Panic Output


tencentcloud_instance.test[0]: Creating...
tencentcloud_instance.test[0]: Still creating... [10s elapsed]
╷
│ Error: Plugin did not respond
│
│   with tencentcloud_instance.test[0],
│   on cvm.tf line 50, in resource "tencentcloud_instance" "test":
│   50: resource "tencentcloud_instance" "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-tencentcloud_v1.77.4 plugin:

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x35f0d72]

goroutine 65 [running]:
github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud.resourceTencentCloudInstanceRead(0xc000c364d0, {0x3b7ec80, 0xc00000f7b8})
	github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/resource_tc_instance.go:888 +0x632
github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud.resourceTencentCloudInstanceCreate(0x3cde280, {0x3b7ec80, 0xc00000f7b8})
	github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/resource_tc_instance.go:825 +0x27b5
github.com/hashicorp/terraform-plugin-sdk/helper/schema.(*Resource).Apply(0xc00030bc20, 0xc000c422d0, 0xc000c446c0, {0x3b7ec80, 0xc00000f7b8})
	github.com/hashicorp/[email protected]/helper/schema/resource.go:310 +0x438
github.com/hashicorp/terraform-plugin-sdk/helper/schema.(*Provider).Apply(0xc00011e000, 0xc000c77a48, 0x43f9fc8, 0xf)
	github.com/hashicorp/[email protected]/helper/schema/provider.go:294 +0x70
github.com/hashicorp/terraform-plugin-sdk/internal/helper/plugin.(*GRPCProviderServer).ApplyResourceChange(0xc00011c7d0, {0xc000c36000, 0x10b0ac6}, 0xc000c36000)
	github.com/hashicorp/[email protected]/internal/helper/plugin/grpc_provider.go:885 +0x7c5
github.com/hashicorp/terraform-plugin-sdk/internal/tfplugin5._Provider_ApplyResourceChange_Handler({0x40287c0, 0xc00011c7d0}, {0x4789d30, 0xc000c2c030}, 0xc000c34000, 0x0)
	github.com/hashicorp/[email protected]/internal/tfplugin5/tfplugin5.pb.go:3305 +0x170
google.golang.org/grpc.(*Server).processUnaryRPC(0xc000464600, {0x47a3300, 0xc000668000}, 0xc000dac000, 0xc000707d10, 0x78d34c0, 0x0)
	google.golang.org/[email protected]/server.go:1024 +0xd1e
google.golang.org/grpc.(*Server).handleStream(0xc000464600, {0x47a3300, 0xc000668000}, 0xc000dac000, 0x0)
	google.golang.org/[email protected]/server.go:1313 +0xa56
google.golang.org/grpc.(*Server).serveStreams.func1.1()
	google.golang.org/[email protected]/server.go:722 +0x98
created by google.golang.org/grpc.(*Server).serveStreams.func1
	google.golang.org/[email protected]/server.go:720 +0xef

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

Ozarklake avatar Aug 31 '22 06:08 Ozarklake

After a few more retries. it's successed. I don't why

Ozarklake avatar Aug 31 '22 07:08 Ozarklake

Hi @Ozarklake ,

In some cases, the CVM instance may launch failed and will be recycled in hours, but the provider still try to access data disk info and leads to nil pointer exception. We have fixed the problem, please try to upgrade to latest version if needed.

Kagashino avatar Oct 26 '22 06:10 Kagashino