Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cognitive Account - Runtime error: Plugin crashed! #28357

Open
1 task done
gitatacn opened this issue Dec 20, 2024 · 2 comments · May be fixed by #28368
Open
1 task done

Cognitive Account - Runtime error: Plugin crashed! #28357

gitatacn opened this issue Dec 20, 2024 · 2 comments · May be fixed by #28368

Comments

@gitatacn
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave comments along the lines of "+1", "me too" or "any updates", they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment and review the contribution guide to help.

Terraform Version

1.8.2

AzureRM Provider Version

4.14.0

Affected Resource(s)/Data Source(s)

azurerm_cognitive_account

Terraform Configuration Files

Config (sensitiv data is overwritten with "example"):

{
  "module": "example",
  "mode": "managed",
  "type": "azurerm_cognitive_account",
  "name": "example",
  "provider": "provider[\"registry.terraform.io/hashicorp/azurerm\"]",
  "instances": [
    {
      "schema_version": 0,
      "attributes": {
        "custom_question_answering_search_service_id": null,
        "custom_question_answering_search_service_key": null,
        "custom_subdomain_name": "example",
        "customer_managed_key": [
          {
            "identity_client_id": "",
            "key_vault_key_id": ""
          }
        ],
        "dynamic_throttling_enabled": false,
        "endpoint": "https://example.openai.azure.com/",
        "fqdns": [],
        "id": "example",
        "identity": [
          {
            "identity_ids": [],
            "principal_id": "example",
            "tenant_id": "example",
            "type": "SystemAssigned"
          }
        ],
        "kind": "OpenAI",
        "local_auth_enabled": true,
        "location": "example",
        "metrics_advisor_aad_client_id": null,
        "metrics_advisor_aad_tenant_id": null,
        "metrics_advisor_super_user_name": null,
        "metrics_advisor_website_name": null,
        "name": "example",
        "network_acls": [
          {
            "default_action": "Deny",
            "ip_rules": [
              "example"
            ],
            "virtual_network_rules": [
              {
                "ignore_missing_vnet_service_endpoint": false,
                "subnet_id": "example"
              },
              {
                "ignore_missing_vnet_service_endpoint": false,
                "subnet_id": "example"
              }
            ]
          }
        ],
        "outbound_network_access_restricted": false,
        "primary_access_key": "example",
        "public_network_access_enabled": true,
        "qna_runtime_endpoint": null,
        "resource_group_name": "example",
        "secondary_access_key": "example",
        "sku_name": "S0",
        "storage": [],
        "tags": {},
        "timeouts": null
      },
      "sensitive_attributes": [
        [
          {
            "type": "get_attr",
            "value": "secondary_access_key"
          }
        ],
        [
          {
            "type": "get_attr",
            "value": "custom_question_answering_search_service_key"
          }
        ],
        [
          {
            "type": "get_attr",
            "value": "primary_access_key"
          }
        ]
      ],
      "dependencies": [
        "example"
      ]
    }
  ]
}

Following message during the tf apply step:
╷
│ Error: Plugin did not respond
│ 
│   with module.example.azurerm_cognitive_account.example,
│   on ../../../modules/example/module.tf line 18, in resource "azurerm_cognitive_account" "example":18: resource "azurerm_cognitive_account" "example" {
│ 
│ The plugin encountered an error, and failed to respond to the
│ plugin.(*GRPCProvider).ApplyResourceChange call. The plugin logs may
│ contain more details.

Debug Output/Panic Output

Stack trace from the terraform-provider-azurerm_v4.14.0_x5 plugin:

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

goroutine 85 [running]:
github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive.expandCognitiveAccountCustomerManagedKey({0xc00316d370?, 0x82c8b7e?, 0x17?})
	github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/cognitive_account_resource.go:847 +0x15a
github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive.resourceCognitiveAccountUpdate(0xc0030adc80, {0x71ed100, 0xc001f23208})
	github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/cognitive_account_resource.go:471 +0xc12
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).update(0x8ab4548?, {0x8ab4548?, 0xc003106990?}, 0xd?, {0x71ed100?, 0xc001f23208?})
	github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/resource.go:828 +0x15f
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).Apply(0xc000f31ce0, {0x8ab4548, 0xc003106990}, 0xc001b885b0, 0xc0030adb00, {0x71ed100, 0xc001f23208})
	github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/resource.go:947 +0x83a
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).ApplyResourceChange(0xc0009d4a20, {0x8ab4548?, 0xc0031068d0?}, 0xc001f24fa0)
	github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/grpc_provider.go:1155 +0xd5c
github.com/hashicorp/terraform-plugin-mux/tf5muxserver.(*muxServer).ApplyResourceChange(0xc0001baf80, {0x8ab4548?, 0xc003106600?}, 0xc001f24fa0)
	github.com/hashicorp/[email protected]/tf5muxserver/mux_server_ApplyResourceChange.go:36 +0x193
github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server.(*server).ApplyResourceChange(0xc000aca960, {0x8ab4548?, 0xc0030edbc0?}, 0xc001b6fce0)
	github.com/hashicorp/[email protected]/tfprotov5/tf5server/server.go:865 +0x3d0
github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_ApplyResourceChange_Handler({0x7f9c8a0, 0xc000aca960}, {0x8ab4548, 0xc0030edbc0}, 0xc0030acf00, 0x0)
	github.com/hashicorp/[email protected]/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:611 +0x1a6
google.golang.org/grpc.(*Server).processUnaryRPC(0xc0001b6e00, {0x8ab4548, 0xc0030edb30}, {0x8ae29c0, 0xc001c65520}, 0xc0030f58c0, 0xc001b90750, 0xe1b8278, 0x0)
	google.golang.org/[email protected]/server.go:1394 +0xe49
google.golang.org/grpc.(*Server).handleStream(0xc0001b6e00, {0x8ae29c0, 0xc001c65520}, 0xc0030f58c0)
	google.golang.org/[email protected]/server.go:1805 +0xe8b
google.golang.org/grpc.(*Server).serveStreams.func2.1()
	google.golang.org/[email protected]/server.go:1029 +0x8b
created by google.golang.org/grpc.(*Server).serveStreams.func2 in goroutine 29
	google.golang.org/[email protected]/server.go:1040 +0x125

Error: The terraform-provider-azurerm_v4.14.0_x5 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.

Expected Behaviour

We have one code source and we deploy multiple instances of the azurerm_cognitive_account. The other instances are working fine, just the one we tried out the customer managed key encryption experience crashes. We already switched back to Microsoft managed key encryption.

Since this switch, on this instance the Microsoft ARM Template has following entry:
"encryption": {
"keySource": "Microsoft.CognitiveServices"

The other instances do not have such a entry.
I guess the specific go file in the services section can not handle this type of information.

Actual Behaviour

Get a crash!

Steps to Reproduce

terraform apply

Important Factoids

No response

References

A similar issue in the backup vault resource which is already solved: #27751

@gitatacn
Copy link
Author

Hi @sinbai & @stephybun & @katbyte,
would be grateful if you could do a similar magic as on: #27762
Thank you :-)

sinbai added a commit to sinbai/terraform-provider-azurerm that referenced this issue Dec 23, 2024
@sinbai
Copy link
Contributor

sinbai commented Dec 23, 2024

Hi @gitatacn thanks for opening this issue. PR has been submitted to fix this issue. Could you please tracking it for more updates?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants