Hey Folks,
I'm getting the following stack trace trying to create a Kafka ACL using Confluent Terraform provider v0.5.0:
confluentcloud_kafka_acl.describe_cluster: Creating...
╷
│ Error: Request cancelled
│
│ with confluentcloud_kafka_acl.describe_cluster,
│ on stack_trace.tf line 22, in resource "confluentcloud_kafka_acl" "describe_cluster":
│ 22: resource "confluentcloud_kafka_acl" "describe_cluster" {
│
│ The plugin.(*GRPCProvider).ApplyResourceChange request was cancelled.
╵
Stack trace from the terraform-provider-confluentcloud_0.5.0 plugin:
panic: reflect: call of reflect.Value.FieldByName on zero Value
goroutine 66 [running]:
reflect.flag.mustBe(...)
/usr/local/golang/1.16/go/src/reflect/value.go:221
reflect.Value.FieldByName(0x0, 0x0, 0x0, 0xdd983e, 0x6, 0x0, 0x140, 0x12e)
/usr/local/golang/1.16/go/src/reflect/value.go:903 +0x25a
github.com/confluentinc/terraform-provider-ccloud/internal/provider.createDiagnosticsWithDetails(0xeda2e0, 0xc000596140, 0xc000267470, 0x3, 0x3)
src/github.com/confluentinc/terraform-provider-confluentcloud/internal/provider/utils.go:304 +0x2c5
github.com/confluentinc/terraform-provider-ccloud/internal/provider.kafkaAclCreate(0xee8fe8, 0xc00060cc60, 0xc0001cae80, 0xd25360, 0xc00022e930, 0xc0001fe3e0, 0x868caa, 0xc0001cad00)
src/github.com/confluentinc/terraform-provider-confluentcloud/internal/provider/resource_kafka_acl.go:179 +0x547
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).create(0xc0003b10a0, 0xee8f78, 0xc00009e4c0, 0xc0001cae80, 0xd25360, 0xc00022e930, 0x0, 0x0, 0x0)
pkg/mod/github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/resource.go:341 +0x17f
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).Apply(0xc0003b10a0, 0xee8f78, 0xc00009e4c0, 0xc0001d2680, 0xc0001cad00, 0xd25360, 0xc00022e930, 0x0, 0x0, 0x0, ...)
pkg/mod/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(0xc000304120, 0xee8f78, 0xc00009e4c0, 0xc00014b090, 0xde2957, 0x12, 0x0)
pkg/mod/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(0xc000788080, 0xee9020, 0xc00009e4c0, 0xc000242000, 0x0, 0x0, 0x0)
pkg/mod/github.com/hashicorp/[email protected]/tfprotov5/tf5server/server.go:603 +0x465
github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_ApplyResourceChange_Handler(0xda0580, 0xc000788080, 0xee9020, 0xc0001181b0, 0xc00060c360, 0x0, 0xee9020, 0xc0001181b0, 0xc0001be600, 0x2f8)
pkg/mod/github.com/hashicorp/[email protected]/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:380 +0x214
google.golang.org/grpc.(*Server).processUnaryRPC(0xc0002f6540, 0xef0618, 0xc0004b4a80, 0xc0001ba000, 0xc0002a25a0, 0x1396a80, 0x0, 0x0, 0x0)
pkg/mod/google.golang.org/[email protected]/server.go:1210 +0x52b
google.golang.org/grpc.(*Server).handleStream(0xc0002f6540, 0xef0618, 0xc0004b4a80, 0xc0001ba000, 0x0)
pkg/mod/google.golang.org/[email protected]/server.go:1533 +0xd0c
google.golang.org/grpc.(*Server).serveStreams.func1.2(0xc0003101d0, 0xc0002f6540, 0xef0618, 0xc0004b4a80, 0xc0001ba000)
pkg/mod/google.golang.org/[email protected]/server.go:871 +0xab
created by google.golang.org/grpc.(*Server).serveStreams.func1
pkg/mod/google.golang.org/[email protected]/server.go:869 +0x1fd
Error: The terraform-provider-confluentcloud_0.5.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.
How to reproduce?
- Create a Terraform file with the following content:
terraform {
required_providers {
confluentcloud = {
source = "confluentinc/confluentcloud"
version = "0.5.0"
}
}
}
provider "confluentcloud" {}
resource "confluentcloud_environment" "stack_trace" {
display_name = "stack_trace"
}
resource "confluentcloud_service_account" "stack_trace" {
display_name = "stack-trace"
description = "Service account for stack trace reproduction"
}
resource "confluentcloud_kafka_cluster" "stack_trace" {
display_name = "default"
availability = "SINGLE_ZONE"
cloud = "GCP"
region = "us-west4"
basic {}
environment {
id = confluentcloud_environment.stack_trace.id
}
}
output "environment_id" {
value = confluentcloud_environment.stack_trace.id
}
output "cluster_id" {
value = confluentcloud_kafka_cluster.stack_trace.id
}
output "service_account_id" {
value = confluentcloud_service_account.stack_trace.id
}
- Run
terraform apply
:
$ terraform apply
confluentcloud_environment.default: Refreshing state... [id=env-3y5do]
confluentcloud_service_account.tessitura_integration: Refreshing state... [id=sa-22g2dq]
confluentcloud_kafka_cluster.default: Refreshing state... [id=lkc-w7769j]
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:
# confluentcloud_environment.stack_trace will be created
+ resource "confluentcloud_environment" "stack_trace" {
+ display_name = "stack_trace"
+ id = (known after apply)
}
# confluentcloud_kafka_cluster.stack_trace will be created
+ resource "confluentcloud_kafka_cluster" "stack_trace" {
+ api_version = (known after apply)
+ availability = "SINGLE_ZONE"
+ bootstrap_endpoint = (known after apply)
+ cloud = "GCP"
+ display_name = "default"
+ http_endpoint = (known after apply)
+ id = (known after apply)
+ kind = (known after apply)
+ rbac_crn = (known after apply)
+ region = "us-west4"
+ basic {}
+ environment {
+ id = (known after apply)
}
}
# confluentcloud_service_account.stack_trace will be created
+ resource "confluentcloud_service_account" "stack_trace" {
+ api_version = (known after apply)
+ description = "Service account for stack trace reproduction"
+ display_name = "stack-trace"
+ id = (known after apply)
+ kind = (known after apply)
}
Plan: 3 to add, 0 to change, 0 to destroy.
Changes to Outputs:
+ cluster_id = (known after apply)
+ environment_id = (known after apply)
+ service_account_id = (known after apply)
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
confluentcloud_service_account.stack_trace: Creating...
confluentcloud_environment.stack_trace: Creating...
confluentcloud_environment.stack_trace: Creation complete after 2s [id=env-zoy90]
confluentcloud_kafka_cluster.stack_trace: Creating...
confluentcloud_service_account.stack_trace: Creation complete after 2s [id=sa-rrm5k0]
confluentcloud_kafka_cluster.stack_trace: Creation complete after 8s [id=lkc-w77kkg]
Apply complete! Resources: 3 added, 0 changed, 0 destroyed.
Outputs:
cluster_id = "lkc-w77kkg"
environment_id = "env-zoy90"
service_account_id = "sa-rrm5k0"
- Create API Key:
confluent api-key create \
--service-account $(terraform output -raw service_account_id) \
--environment $(terraform output -raw environment_id) \
--resource $(terraform output -raw cluster_id)
It may take a couple of minutes for the API key to be ready.
Save the API key and secret. The secret is not retrievable later.
+---------+------------------------------------------------------------------+
| API Key | XXX_api_key_here_XXX |
| Secret | XXX_secret_here_XXX |
+---------+------------------------------------------------------------------+
- Using the API Key and Secret from previous command output, add the following code to the Terraform file created in point 1:
resource "confluentcloud_kafka_acl" "describe_cluster" {
kafka_cluster = confluentcloud_kafka_cluster.stack_trace.id
http_endpoint = confluentcloud_kafka_cluster.stack_trace.http_endpoint
resource_type = "CLUSTER"
resource_name = "kafka-cluster"
pattern_type = "LITERAL"
principal = "User:${confluentcloud_service_account.stack_trace.id}"
host = "*"
operation = "DESCRIBE"
permission = "ALLOW"
credentials {
key = "XXX_api_key_here_XXX"
secret = "XXX_secret_here_XXX"
}
}
- Finally, run
terraform apply
again to get the stack trace:
$ terraform apply
confluentcloud_service_account.tessitura_integration: Refreshing state... [id=sa-22g2dq]
confluentcloud_environment.stack_trace: Refreshing state... [id=env-zoy90]
confluentcloud_environment.default: Refreshing state... [id=env-3y5do]
confluentcloud_service_account.stack_trace: Refreshing state... [id=sa-rrm5k0]
confluentcloud_kafka_cluster.stack_trace: Refreshing state... [id=lkc-w77kkg]
confluentcloud_kafka_cluster.default: Refreshing state... [id=lkc-w7769j]
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:
# confluentcloud_kafka_acl.describe_cluster will be created
+ resource "confluentcloud_kafka_acl" "describe_cluster" {
+ host = "*"
+ http_endpoint = "https://pkc-6ojv2.us-west4.gcp.confluent.cloud:443"
+ id = (known after apply)
+ kafka_cluster = "lkc-w77kkg"
+ operation = "DESCRIBE"
+ pattern_type = "LITERAL"
+ permission = "ALLOW"
+ principal = "User:sa-rrm5k0"
+ resource_name = "kafka-cluster"
+ resource_type = "CLUSTER"
+ credentials {
+ key = (sensitive value)
+ secret = (sensitive value)
}
}
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
confluentcloud_kafka_acl.describe_cluster: Creating...
╷
│ Error: Request cancelled
│
│ with confluentcloud_kafka_acl.describe_cluster,
│ on stack_trace.tf line 22, in resource "confluentcloud_kafka_acl" "describe_cluster":
│ 22: resource "confluentcloud_kafka_acl" "describe_cluster" {
│
│ The plugin.(*GRPCProvider).ApplyResourceChange request was cancelled.
╵
Stack trace from the terraform-provider-confluentcloud_0.5.0 plugin:
panic: reflect: call of reflect.Value.FieldByName on zero Value
goroutine 66 [running]:
reflect.flag.mustBe(...)
/usr/local/golang/1.16/go/src/reflect/value.go:221
reflect.Value.FieldByName(0x0, 0x0, 0x0, 0xdd983e, 0x6, 0x0, 0x140, 0x12e)
/usr/local/golang/1.16/go/src/reflect/value.go:903 +0x25a
github.com/confluentinc/terraform-provider-ccloud/internal/provider.createDiagnosticsWithDetails(0xeda2e0, 0xc000596140, 0xc000267470, 0x3, 0x3)
src/github.com/confluentinc/terraform-provider-confluentcloud/internal/provider/utils.go:304 +0x2c5
github.com/confluentinc/terraform-provider-ccloud/internal/provider.kafkaAclCreate(0xee8fe8, 0xc00060cc60, 0xc0001cae80, 0xd25360, 0xc00022e930, 0xc0001fe3e0, 0x868caa, 0xc0001cad00)
src/github.com/confluentinc/terraform-provider-confluentcloud/internal/provider/resource_kafka_acl.go:179 +0x547
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).create(0xc0003b10a0, 0xee8f78, 0xc00009e4c0, 0xc0001cae80, 0xd25360, 0xc00022e930, 0x0, 0x0, 0x0)
pkg/mod/github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/resource.go:341 +0x17f
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).Apply(0xc0003b10a0, 0xee8f78, 0xc00009e4c0, 0xc0001d2680, 0xc0001cad00, 0xd25360, 0xc00022e930, 0x0, 0x0, 0x0, ...)
pkg/mod/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(0xc000304120, 0xee8f78, 0xc00009e4c0, 0xc00014b090, 0xde2957, 0x12, 0x0)
pkg/mod/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(0xc000788080, 0xee9020, 0xc00009e4c0, 0xc000242000, 0x0, 0x0, 0x0)
pkg/mod/github.com/hashicorp/[email protected]/tfprotov5/tf5server/server.go:603 +0x465
github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_ApplyResourceChange_Handler(0xda0580, 0xc000788080, 0xee9020, 0xc0001181b0, 0xc00060c360, 0x0, 0xee9020, 0xc0001181b0, 0xc0001be600, 0x2f8)
pkg/mod/github.com/hashicorp/[email protected]/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:380 +0x214
google.golang.org/grpc.(*Server).processUnaryRPC(0xc0002f6540, 0xef0618, 0xc0004b4a80, 0xc0001ba000, 0xc0002a25a0, 0x1396a80, 0x0, 0x0, 0x0)
pkg/mod/google.golang.org/[email protected]/server.go:1210 +0x52b
google.golang.org/grpc.(*Server).handleStream(0xc0002f6540, 0xef0618, 0xc0004b4a80, 0xc0001ba000, 0x0)
pkg/mod/google.golang.org/[email protected]/server.go:1533 +0xd0c
google.golang.org/grpc.(*Server).serveStreams.func1.2(0xc0003101d0, 0xc0002f6540, 0xef0618, 0xc0004b4a80, 0xc0001ba000)
pkg/mod/google.golang.org/[email protected]/server.go:871 +0xab
created by google.golang.org/grpc.(*Server).serveStreams.func1
pkg/mod/google.golang.org/[email protected]/server.go:869 +0x1fd
Error: The terraform-provider-confluentcloud_0.5.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.
Additional information
$ cat /etc/os-release
NAME="Ubuntu"
VERSION="20.04.3 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.04.3 LTS"
VERSION_ID="20.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=focal
UBUNTU_CODENAME=focal
$ terraform -v
Terraform v1.1.3
on linux_amd64
+ provider registry.terraform.io/confluentinc/confluentcloud v0.5.0
Your version of Terraform is out of date! The latest version
is 1.1.7. You can update by downloading from https://www.terraform.io/downloads.html