Commvault / terraform-provider-commvault

Terraform module for Commvault
5 stars 1 forks source link

Error: The terraform-provider-commvault_v1.2.10 plugin crashed! #15

Open bandicoot00 opened 6 months ago

bandicoot00 commented 6 months ago

Hi guys! Im trying to create an user in my commvault master server using code with terraform. All looks good cause command terraform plan doesnt give me any error and show me the output about new user will be created with my credentials. When i run terraform apply i get this error:

``Error: The terraform-provider-commvault_v1.2.10 plugin crashed!

Put the full output i got:

**commvault_user.eromero: Creating...
╷
│ Error: Plugin did not respond
│ 
│   with commvault_user.eromero,
│   on commvault_user.tf line 14, in resource "commvault_user" "eromero":
│   14: resource "commvault_user" "eromero"{ 
│ 
│ 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-commvault_v1.2.10 plugin:

panic: Post "/user": unsupported protocol scheme ""

goroutine 55 [running]:
terraform-provider-commvault/commvault/handler.makeHttpRequest({0xd71eea, 0x5}, {0xd71765, 0x4}, {0xd7bac0, 0xf}, {0xc00020e3c0, 0x12b, 0x12b}, {0xd7bac0, ...}, ...)
        terraform-provider-commvault/commvault/handler/CommvaultClient.go:91 +0x69c
terraform-provider-commvault/commvault/handler.UserCreate({{{{0xc00013d6f8, 0x7}}, {0x0, 0x0}, {0x0, 0x0}, {0xc00003af78, 0x12}, {0xc00013d700, 0xe}, ...}}, ...)
        terraform-provider-commvault/commvault/handler/UserHandler.go:13 +0x12e
terraform-provider-commvault/commvault.resourceUserCreate(0xc6a960, {0x0, 0x0})
        terraform-provider-commvault/commvault/resource_user.go:66 +0x1db
github.com/hashicorp/terraform-plugin-sdk/helper/schema.(*Resource).Apply(0xc000391170, 0xc000554cd0, 0xc0008196c0, {0x0, 0x0})
        github.com/hashicorp/terraform-plugin-sdk@v1.12.0/helper/schema/resource.go:310 +0x438
github.com/hashicorp/terraform-plugin-sdk/helper/schema.(*Provider).Apply(0xc000510080, 0xc0001b3a48, 0xd7ba39, 0xf)
        github.com/hashicorp/terraform-plugin-sdk@v1.12.0/helper/schema/provider.go:294 +0x70
github.com/hashicorp/terraform-plugin-sdk/internal/helper/plugin.(*GRPCProviderServer).ApplyResourceChange(0xc000506020, {0xc0003e0540, 0x50f2e6}, 0xc0003e0540)
        github.com/hashicorp/terraform-plugin-sdk@v1.12.0/internal/helper/plugin/grpc_provider.go:885 +0x7c5
github.com/hashicorp/terraform-plugin-sdk/internal/tfplugin5._Provider_ApplyResourceChange_Handler({0xd37420, 0xc000506020}, {0xef79b0, 0xc0001ef590}, 0xc0007bd080, 0x0)
        github.com/hashicorp/terraform-plugin-sdk@v1.12.0/internal/tfplugin5/tfplugin5.pb.go:3305 +0x170
google.golang.org/grpc.(*Server).processUnaryRPC(0xc000114480, {0xf04108, 0xc000572000}, 0xc000118900, 0xc0005afd10, 0x144b300, 0x0)
        google.golang.org/grpc@v1.27.1/server.go:1024 +0xd1e
google.golang.org/grpc.(*Server).handleStream(0xc000114480, {0xf04108, 0xc000572000}, 0xc000118900, 0x0)
        google.golang.org/grpc@v1.27.1/server.go:1313 +0xa56
google.golang.org/grpc.(*Server).serveStreams.func1.1()
        google.golang.org/grpc@v1.27.1/server.go:722 +0x98
created by google.golang.org/grpc.(*Server).serveStreams.func1
        google.golang.org/grpc@v1.27.1/server.go:720 +0xef

Error: The terraform-provider-commvault_v1.2.10 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 script:

terraform {
  required_providers {
    aws = {
      source  = "hashicorp/aws"
      version = "~> 5.30.0"
    }
    commvault = {
      source = "Commvault/commvault"
      version = "1.2.10"
    }
  }

}
resource "commvault_user" "eromero"{
    user_name = "eromero"
    full_name = "Eduardo"
    email = "eromero@gmail.com"
}
cvltmaheshp commented 6 months ago

@bandicoot00 could you try the v2 resource ? https://registry.terraform.io/providers/Commvault/commvault/latest/docs/resources/user_v2

bandicoot00 commented 6 months ago

Hi @cvltmaheshp! First of all thank you so much for your answer, Im using terraform for about 1 month and im noob hahaha. Yes, i've tried to create the user with the commvault_userv2 module but when i launch my terraform apply i get this error: commvault_user_v2.eromero: Creating...

╷
│ Error: operation [CreateUser] failed, Error Post "/V4/user": unsupported protocol scheme ""
│ 
│   with commvault_user_v2.eromero,
│   on commvault_user.tf line 1, in resource "commvault_user_v2" "eromero":
│    1: resource "commvault_user_v2" "eromero" {
│ 
╵
cvltmaheshp commented 6 months ago

Pls go through this - https://registry.terraform.io/providers/Commvault/commvault/latest/docs

You have to first initialize the provider.

provider "commvault" { web_service_url = "URL of the commserver webservice/webconsole api endpoint" user_name = "username that is used to call APIs" password = "password in base 64 encoded format" ignore_cert = "true/false to ignore certificate warnings for https endpoints" }

bandicoot00 commented 6 months ago

Hi @cvltmaheshp and thanks again for ur answer. I've tested the last code you provide me and have good and bad news I launch my terraform apply and all look good but it throw me a "access denied" error.

commvault_user.eromero: Creating...

╷
│ Error: User creation failed with Error: Access denied
│ 
│   with commvault_user.eromero,
│   on commvault_user.tf line 8, in resource "commvault_user" "eromero":
│    8: resource "commvault_user" "eromero"{ 
│ 
╵
jeliasson commented 5 months ago

@bandicoot00 Besides from ensuring that the user is setup in Commvault with appropriate permissions, make sure that you base64 encoded the password to the provider.

bandicoot00 commented 5 months ago

Sorry @jeliasson, i dont usually sign in Git hub wih this account and didnt see your answer. I finally fixed it with my workmate. Thank you guys for your answer

jeliasson commented 5 months ago

@bandicoot00 No worries. For future references, what was the solution?