terraform-provider-azuredevops icon indicating copy to clipboard operation
terraform-provider-azuredevops copied to clipboard

Error: The terraform-provider-azuredevops_v1.0.1 plugin crashed!

Open callumhester opened this issue 11 months ago • 4 comments

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 (and Azure DevOps Provider) Version

Terraform Version: 1.7.5 Azure DevOps Provider Version: 1.0.1

Affected Resource(s)

azuredevops_project azuredevops_project_features azuredevops_group_entitlement azuredevops_group_membership data.azuredevops_group azuredevops_iteration_permissions azuredevops_area_permissions

Terraform Configuration Files

terraform {
  required_version = ">= __terraform_required_version__"
  required_providers {
    azuredevops = {
      source = "microsoft/azuredevops"
      version = "__terraform_ado_version__"
    }
  }
}
resource "azuredevops_project" "project" {
  name        = var.project_name
  description = var.project_description
  work_item_template = "Scrum"
}
resource "azuredevops_project_features" "project" {
  project_id = var.project_id
  features = {
    "boards"       = var.project_type != "squad" ? "disabled" : "enabled"
    "repositories" = var.project_type != "team" ? "disabled" : "enabled"
    "pipelines"    = var.project_type != "team" ? "disabled" : "enabled"
    "testplans"    = var.project_type != "squad" ? "disabled" : "enabled"
    "artifacts"    = var.project_type != "team" ? "disabled" : "enabled"
  }
}
resource "azuredevops_group_entitlement" "entitilement" {
  origin    = "aad"
  origin_id = var.entraid_group_id
  account_license_type = var.project_type != "squad" ? "express" : "stakeholder"
}
data "azuredevops_group" "group" {
  project_id = var.project_id
  name = "${var.project_name} Team"
}
resource "azuredevops_group_membership" "group_membership" {
  group = data.azuredevops_group.group.descriptor
  members = [
    azuredevops_group_entitlement.entitilement.descriptor
  ]
}
resource "azuredevops_iteration_permissions" "iteration_permissions" {
  project_id = var.project_id
  principal  = data.azuredevops_group.group.id
  permissions = {
    CREATE_CHILDREN = "Allow"
    GENERIC_WRITE   = "Allow"
    GENERIC_READ    = "Allow"
    DELETE          = "Deny"
  }
}
resource "azuredevops_area_permissions" "area_permissions" {
  project_id = var.project_id
  principal  = data.azuredevops_group.group.id
  permissions = {
    CREATE_CHILDREN = "Allow"
    GENERIC_READ    = "Allow"
    DELETE          = "Deny"
    WORK_ITEM_READ  = "Allow"
    WORK_ITEM_WRITE = "Allow"
  }
}

Debug Output

"https://gist.github.com/callumhester/59b1184efe617adc3c35aac79b06e5b0.js"

Expected Behavior

Azure DevOps project and associated resources should build. This was working fine on the 19th of March 2024, but come 20th, the error message starting appearing. No changes between the 19th and 20th, the code is the same.

Actual Behavior

When running Terraform plan or apply, the run crashes with error: Error: The terraform-provider-azuredevops_v1.0.1 plugin crashed!

Steps to Reproduce

  1. terraform apply

callumhester avatar Mar 22 '24 10:03 callumhester

After the entitlement group deleted. The HTTP status code will be 200 but response will be null

https://learn.microsoft.com/en-us/rest/api/azure/devops/memberentitlementmanagement/group-entitlements/get?view=azure-devops-rest-7.1&tabs=HTTP

If the group entitlement does not exist, returns null.

xuzhang3 avatar Mar 25 '24 06:03 xuzhang3

Hi,

Even after removing the entitlement and project manually. The issue still persists. I've dropped the provider version to 1.0.0 and the same issue appears. Very frustrating, as it's blocking my pipeline from completing and the Azure DevOps Terraform part is only 1 module out of many. Due to this, the remaining modules (azurerm) cannot be updated. If I remove the provider and module from the root of my terraform file, it is still in state, so it still errors.

callumhester avatar Mar 25 '24 10:03 callumhester

I've commented out the Azure DevOps module and left the provider + required provider inside the root main.tf. File it now no longer shows errors on the project or entitlement, but still crashes.

│ 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.
╵

##[error]╷
│ 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.
╵

##[error]
Stack trace from the terraform-provider-azuredevops_v1.0.1 plugin:

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


Error: The terraform-provider-azuredevops_v1.0.1 plugin crashed!

callumhester avatar Mar 25 '24 11:03 callumhester

@callumhester can you try remove the azuredevops_group_membership from the state file with terraform state rm xxx then remove the ADO configurations?

xuzhang3 avatar Mar 26 '24 08:03 xuzhang3