#199 ⁃ Terraform application token generation issue while using RBAC on Astra DB

Description

Hi there,

Please find the description of the issue below.

Terraform Version

Terraform v1.2.8

Affected Resource(s)

-astra_token

Terraform Configuration Files

Debug Output

Error: json: cannot unmarshal object into Go value of type string


│ with astra_role.org_admin,
│ on main_poc.tf line 11, in resource "astra_role" "org_admin":
│ 11: resource "astra_role" "org_admin" {

Panic Output

panic: runtime error: invalid memory address or nil pointer dereference

[signal SIGSEGV: segmentation violation code=0x2 addr=0x0 pc=0x100c6ed6c]

goroutine 23 [running]:
github.com/datastax/terraform-provider-astra/v2/internal/provider.listToken({0x100f7cbc8?, 0x14000694d20?}, 0x10146ef40?, {0x140005a43a8, 0x18})
github.com/datastax/terraform-provider-astra/v2/internal/provider/data_source_token.go:84 +0x5c
github.com/datastax/terraform-provider-astra/v2/internal/provider.resourceTokenRead({0x100f7cbc8, 0x14000694d20}, 0x140005bb880, {0x100f2cd20?, 0x140000d27e0?})
github.com/datastax/terraform-provider-astra/v2/internal/provider/resource_token.go:126 +0x1c8
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).read(0x140003ddc00, {0x100f7cc00, 0x140005dade0}, 0xd?, {0x100f2cd20, 0x140000d27e0})
github.com/hashicorp/terraform-plugin-sdk/v2@v2.24.1/helper/schema/resource.go:724 +0xec
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).RefreshWithoutUpgrade(0x140003ddc00, {0x100f7cc00, 0x140005dade0}, 0x140005c1520, {0x100f2cd20, 0x140000d27e0})
github.com/hashicorp/terraform-plugin-sdk/v2@v2.24.1/helper/schema/resource.go:1015 +0x46c
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).ReadResource(0x140003051b8, {0x100f7cc00?, 0x140005dacc0?}, 0x1400059aa80)
github.com/hashicorp/terraform-plugin-sdk/v2@v2.24.1/helper/schema/grpc_provider.go:613 +0x40c
github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server.(*server).ReadResource(0x140004241e0, {0x100f7cc00?, 0x140005da4e0?}, 0x140006949c0)
github.com/hashicorp/terraform-plugin-go@v0.14.1/tfprotov5/tf5server/server.go:748 +0x3ec
github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_ReadResource_Handler({0x100f41b00?, 0x140004241e0}, {0x100f7cc00, 0x140005da4e0}, 0x140001b2c40, 0x0)
github.com/hashicorp/terraform-plugin-go@v0.14.1/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:349 +0x174
google.golang.org/grpc.(*Server).processUnaryRPC(0x140003fc000, {0x100f7f720, 0x14000003380}, 0x140001bcd80, 0x140003f75f0, 0x101461210, 0x0)
google.golang.org/grpc@v1.50.1/server.go:1340 +0xb90
google.golang.org/grpc.(*Server).handleStream(0x140003fc000, {0x100f7f720, 0x14000003380}, 0x140001bcd80, 0x0)
google.golang.org/grpc@v1.50.1/server.go:1713 +0x840
google.golang.org/grpc.(*Server).serveStreams.func1.2()
google.golang.org/grpc@v1.50.1/server.go:965 +0x88
created by google.golang.org/grpc.(*Server).serveStreams.func1
google.golang.org/grpc@v1.50.1/server.go:963 +0x298

Error: The terraform-provider-astra_v2.1.10 plugin crashed!

Expected Behavior

The application token should have been generated based on the role_id that was passed

Actual Behavior

Running 'terraform apply' on resource 'astra-token' has resulted in the issue described above

Steps to Reproduce

1) Create a custom role using terraform

2) Attempt to create an application token based on the role created using a code snippet like:

Issue is synchronized with a Github issue by Unito
Issue Number: 199

Activity

Show:

Details

Assignee

Reporter

Components

Priority

Created January 18, 2023 at 9:30 PM
Updated February 3, 2023 at 1:34 AM