terraform-provider-prismacloud
terraform-provider-prismacloud copied to clipboard
import prismacloud_cloud_account_v2 causes runtime error
Describe the bug
I am attempting to import our existing cloud accounts into our terraform state to be managed. I have defined the basics of each of our aws account and receive a runtime error when attempting to import:
terraform import prismacloud_cloud_account_v2.aws "myid" Acquiring state lock. This may take a few moments... data.prismacloud_account_group.aws: Reading... data.prismacloud_account_group.aws: Read complete after 1s [id=mygroup] prismacloud_cloud_account_v2.aws: Importing from ID "myid"... prismacloud_cloud_account_v2.aws: Import prepared! Prepared prismacloud_cloud_account_v2 for import prismacloud_cloud_account_v2.aws: Refreshing state... [id=myid] ╷ │ Error: Plugin did not respond │ │ The plugin encountered an error, and failed to respond to the plugin.(*GRPCProvider).ReadResource call. The plugin logs may contain more details. ╵
Stack trace from the terraform-provider-prismacloud_v1.5.3.exe plugin:
panic: runtime error: index out of range [1] with length 1
goroutine 89 [running]: github.com/terraform-providers/terraform-provider-prismacloud/prismacloud.IdToTwoStrings(...) github.com/terraform-providers/terraform-provider-prismacloud/prismacloud/conversions.go:21 github.com/terraform-providers/terraform-provider-prismacloud/prismacloud.readV2CloudAccount({0x1066258, 0xc00007cf80}, 0xc000338880, {0xef23e0, 0xc000154a50}) github.com/terraform-providers/terraform-provider-prismacloud/prismacloud/resource_v2_cloud_account.go:1265 +0x1ff github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).read(0xc0004020c0, {0x1066258, 0xc00007cf80}, 0x24, {0xef23e0, 0xc000154a50}) github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/resource.go:297 +0x1a3 github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).RefreshWithoutUpgrade(0xc0004020c0, {0x1066258, 0xc00007cf80}, 0xc00013c930, {0xef23e0, 0xc000154a50}) github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/resource.go:564 +0x35b github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).ReadResource(0xc000004528, {0x1066258, 0xc00007cf80}, 0xc00007cfc0) github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/grpc_provider.go:575 +0x4bd github.com/hashicorp/terraform-plugin-go/tfprotov5/server.(*server).ReadResource(0xc0000739c0, {0x1066300, 0xc000521440}, 0xc0004b2840) github.com/hashicorp/[email protected]/tfprotov5/server/server.go:298 +0x1fb github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_ReadResource_Handler({0xf24640, 0xc0000739c0}, {0x1066300, 0xc000521440}, 0xc00013c770, 0x0) github.com/hashicorp/[email protected]/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:344 +0x170 google.golang.org/grpc.(*Server).processUnaryRPC(0xc0002e0540, {0x1073a18, 0xc0001d4000}, 0xc00028a000, 0xc00046ef30, 0x1515bf0, 0x0) google.golang.org/[email protected]/server.go:1295 +0xb03 google.golang.org/grpc.(*Server).handleStream(0xc0002e0540, {0x1073a18, 0xc0001d4000}, 0xc00028a000, 0x0) google.golang.org/[email protected]/server.go:1636 +0xa2a google.golang.org/grpc.(*Server).serveStreams.func1.2() google.golang.org/[email protected]/server.go:932 +0x98 created by google.golang.org/grpc.(*Server).serveStreams.func1 google.golang.org/[email protected]/server.go:930 +0x294
Error: The terraform-provider-prismacloud_v1.5.3.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.`
Steps to reproduce
I experience the same issue on our aws, azure and gcp accounts. I am currently testing with only the aws account defined. Example:
data "prismacloud_account_group" "aws" {
name = "AWS Group"
}
resource "prismacloud_cloud_account_v2" "aws" {
disable_on_destroy = true
aws {
name = "AWS Account"
account_id = "myid"
enabled = true
role_arn = "myarn"
account_type = "organization"
group_ids = [ data.prismacloud_account_group.aws.group_id ]
}
}
terraform import prismacloud_cloud_account_v2.aws "myid"
Your Environment
terraform v1.7.4 prismacloud provider v1.5.3 Windows 10 22H2