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

Plugin crashes with 3.43.0_x5 #20508

Closed
1 task done
mtijrobinson opened this issue Feb 16, 2023 · 7 comments · Fixed by #20517 or #20584
Closed
1 task done

Plugin crashes with 3.43.0_x5 #20508

mtijrobinson opened this issue Feb 16, 2023 · 7 comments · Fixed by #20517 or #20584

Comments

@mtijrobinson
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 "+1" or "me too" comments, 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

Terraform Version

1.3.6

AzureRM Provider Version

3.43.0

Affected Resource(s)/Data Source(s)

azurerm_storage_account, azurerm_storage_share, multiple others

Terraform Configuration Files

resource "azurerm_storage_account" "leapxl" {
  name                          = "${local.stg_pfx}stg01"
  resource_group_name           = azurerm_resource_group.leapxl.name
  location                      = azurerm_resource_group.leapxl.location
  account_tier                  = "Standard"
  account_replication_type      = "LRS"
  public_network_access_enabled = true

  tags = local.tags
}

resource "azurerm_storage_account_network_rules" "leapxl" {
  storage_account_id         = azurerm_storage_account.leapxl.id

  default_action             = "Deny"
  ip_rules                   = [local.myip]
  virtual_network_subnet_ids = [azurerm_subnet.k8s.id]
  bypass                     = ["AzureServices"]
}


resource "azurerm_storage_share" "k8s_api" {
  name                 = "leap-api-files"
  storage_account_name = azurerm_storage_account.leapxl.name
  quota                = 5120
}

resource "azurerm_storage_share" "k8s_appserver_tomcat" {
  name                 = "leap-appserver-tomcat"
  storage_account_name = azurerm_storage_account.leapxl.name
  quota                = 5120
}


resource "azurerm_user_assigned_identity" "leapxl" {
  name                = "${local.name_pfx}-k8s-uaid"
  resource_group_name = azurerm_resource_group.leapxl.name
  location            = azurerm_resource_group.leapxl.location
  tags                = local.tags
}

resource "azurerm_kubernetes_cluster" "leapxl" {
  name                            = "${local.name_pfx}-k8s"
  location                        = azurerm_resource_group.leapxl.location
  resource_group_name             = azurerm_resource_group.leapxl.name
  dns_prefix                      = local.name_pfx
  kubernetes_version              = var.kubernetes_version

  default_node_pool {
    name       = "main"
    node_count = var.agent_count
    vm_size    = var.agent_sku

    enable_auto_scaling = var.agent_autoscale_enable
    min_count           = var.agent_autoscale_enable ? var.agent_autoscale_min : null
    max_count           = var.agent_autoscale_enable ? var.agent_autoscale_max : null

    os_disk_type         = "Ephemeral"
    vnet_subnet_id       = azurerm_subnet.k8s.id
    node_labels          = {}
    node_taints          = []
    tags                 = {}
    max_pods             = 100
  }

  identity {
    type                      = "UserAssigned"
    identity_ids        = azurerm_user_assigned_identity.leapxl.id
  }

  network_profile {
    load_balancer_sku = "standard"
    network_plugin    = "azure"
    network_policy    = "calico"
  }

  tags = local.tags
}

Debug Output/Panic Output

2023-02-16T19:19:30.8633732Z Error: Plugin did not respond
2023-02-16T19:19:30.8633876Z 
2023-02-16T19:19:30.8634184Z   with module.leapxl.azurerm_storage_account.leapxl,
2023-02-16T19:19:30.8634829Z   on ../leapxl-terraform/15-storage.tf line 2, in resource "azurerm_storage_account" "leapxl":
2023-02-16T19:19:30.8635283Z    2: resource "azurerm_storage_account" "leapxl" {
2023-02-16T19:19:30.8635472Z 
2023-02-16T19:19:30.8635782Z The plugin encountered an error, and failed to respond to the
2023-02-16T19:19:30.8636238Z plugin.(*GRPCProvider).ReadResource call. The plugin logs may contain more
2023-02-16T19:19:30.8636611Z details.
2023-02-16T19:19:30.8636717Z 
2023-02-16T19:19:30.8636979Z Error: Plugin did not respond
2023-02-16T19:19:30.8637133Z 
2023-02-16T19:19:30.8637435Z   with module.leapxl.azurerm_kubernetes_cluster.leapxl,
2023-02-16T19:19:30.8638017Z   on ../leapxl-terraform/20-k8s.tf line 36, in resource "azurerm_kubernetes_cluster" "leapxl":
2023-02-16T19:19:30.8638492Z   36: resource "azurerm_kubernetes_cluster" "leapxl" {
2023-02-16T19:19:30.8638673Z 
2023-02-16T19:19:30.8638988Z The plugin encountered an error, and failed to respond to the
2023-02-16T19:19:30.8639447Z plugin.(*GRPCProvider).ReadResource call. The plugin logs may contain more
2023-02-16T19:19:30.8639813Z details.
2023-02-16T19:19:30.8639918Z 
2023-02-16T19:19:30.8640333Z Stack trace from the terraform-provider-azurerm_v3.43.0_x5 plugin:
2023-02-16T19:19:30.8640546Z 
2023-02-16T19:19:30.8640888Z panic: runtime error: invalid memory address or nil pointer dereference
2023-02-16T19:19:30.8641360Z [signal SIGSEGV: segmentation violation code=0x1 addr=0x10 pc=0x507cf39]
2023-02-16T19:19:30.8641640Z 
2023-02-16T19:19:30.8641905Z goroutine 454 [running]:
2023-02-16T19:19:30.8642590Z github.com/hashicorp/terraform-provider-azurerm/internal/services/containers.resourceKubernetesClusterRead(0xc0020d8400, {0x617aa80?, 0xc002388400})
2023-02-16T19:19:30.8643437Z 	github.com/hashicorp/terraform-provider-azurerm/internal/services/containers/kubernetes_cluster_resource.go:2249 +0x1bf9
2023-02-16T19:19:30.8644296Z github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).read(0x74a9540?, {0x74a9540?, 0xc002679320?}, 0xd?, {0x617aa80?, 0xc002388400?})
2023-02-16T19:19:30.8645050Z 	github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/resource.go:712 +0x178
2023-02-16T19:19:30.8645923Z github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).RefreshWithoutUpgrade(0xc000ae2460, {0x74a9540, 0xc002679320}, 0xc0019fb040, {0x617aa80, 0xc002388400})
2023-02-16T19:19:30.8646721Z 	github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/resource.go:1015 +0x585
2023-02-16T19:19:30.8647536Z github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).ReadResource(0xc0003c33c8, {0x74a9540?, 0xc002679200?}, 0xc001a2c7c0)
2023-02-16T19:19:30.8648303Z 	github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/grpc_provider.go:613 +0x4a5
2023-02-16T19:19:30.8649105Z github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server.(*server).ReadResource(0xc000b7db80, {0x74a9540?, 0xc002678c30?}, 0xc001a197a0)
2023-02-16T19:19:30.8649836Z 	github.com/hashicorp/[email protected]/tfprotov5/tf5server/server.go:748 +0x4b1
2023-02-16T19:19:30.8650796Z github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_ReadResource_Handler({0x68a5140?, 0xc000b7db80}, {0x74a9540, 0xc002678c30}, 0xc0008acf50, 0x0)
2023-02-16T19:19:30.8651666Z 	github.com/hashicorp/[email protected]/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:349 +0x170
2023-02-16T19:19:30.8652338Z google.golang.org/grpc.(*Server).processUnaryRPC(0xc0001681e0, {0x74b98c0, 0xc0012f8680}, 0xc00288d7a0, 0xc001210d20, 0xb98eff0, 0x0)
2023-02-16T19:19:30.8652905Z 	google.golang.org/[email protected]/server.go:1340 +0xd23
2023-02-16T19:19:30.8653417Z google.golang.org/grpc.(*Server).handleStream(0xc0001681e0, {0x74b98c0, 0xc0012f8680}, 0xc00288d7a0, 0x0)
2023-02-16T19:19:30.8653924Z 	google.golang.org/[email protected]/server.go:1713 +0xa2f
2023-02-16T19:19:30.8654332Z google.golang.org/grpc.(*Server).serveStreams.func1.2()
2023-02-16T19:19:30.8654824Z 	google.golang.org/[email protected]/server.go:965 +0x98
2023-02-16T19:19:30.8655254Z created by google.golang.org/grpc.(*Server).serveStreams.func1
2023-02-16T19:19:30.8655687Z 	google.golang.org/[email protected]/server.go:963 +0x28a
2023-02-16T19:19:30.8655875Z 
2023-02-16T19:19:30.8656292Z Error: The terraform-provider-azurerm_v3.43.0_x5 plugin crashed!
2023-02-16T19:19:30.8656501Z 
2023-02-16T19:19:30.8656844Z This is always indicative of a bug within the plugin. It would be immensely
2023-02-16T19:19:30.8657408Z helpful if you could report the crash with the plugin's maintainers so that it
2023-02-16T19:19:30.8657861Z can be fixed. The output above should help diagnose the issue.
2023-02-16T19:19:30.8658057Z

Expected Behaviour

Deployment from Azure DevOps has been working until version updates.

Actual Behaviour

Deployments fail. Plugin failures are inconsistent; sometimes azurerm_storage_account, sometimes azurerm_storage_share, sometimes azurerm_kubernetes_cluster. Always is a "failed to respond to the plugin.(*GRPCProvider).ReadResource call"

Steps to Reproduce

No response

Important Factoids

Uses Helm 3.11.1

References

No response

@aristosvo
Copy link
Collaborator

Hi @mtijrobinson ! Thanks for raising this.

Seems like this part of the code is to blame.

I'm just wondering why this is only surfacing for you..

@mtijrobinson
Copy link
Author

Thank you all.

@github-actions
Copy link

This functionality has been released in v3.44.1 of the Terraform Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you!

@mtijrobinson
Copy link
Author

@aristosvo Looks like there's at least one other access to securityProfile without a nil test -- still causing crashes.

azureKeyVaultKms := flattenKubernetesClusterDataSourceKeyVaultKms(props.SecurityProfile.AzureKeyVaultKms)

Not sure the protocol here -- do I need to submit a new bug report? or can this one reopen?

Is this something I can fix? Not sure why my securityProfile would be empty in the first place.

image

@aristosvo
Copy link
Collaborator

aristosvo commented Feb 21, 2023

I'll take a look! PR is opened.

Edit: Merged

@mtijrobinson
Copy link
Author

I'll take a look! PR is opened.

Edit: Merged

Thanks again!

@github-actions
Copy link

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 24, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.