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

Plugin Crashed Terraform plan

Open sujitks opened this issue 1 year ago • 9 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

Affected Resource(s)

  • azuredevops_v0.5.0

Terraform Configuration Files

# Copy-paste your Terraform configurations here - for large Terraform configs,
# please use a service like Dropbox and share a link to the ZIP file. For
# security, you can also encrypt the files using our GPG public key: https://keybase.io/hashicorp
provider "azuredevops" {
  personal_access_token = var.AZDO_PERSONAL_ACCESS_TOKEN
  org_service_url       = var.AZDO_ORG_SERVICE_URL
}

data "azuredevops_project" "multispecies" {
  name = "Project Name in ADO"
}
resource "azuredevops_serviceendpoint_azurerm" "dev-serviceendpoints" {
  for_each              = { for k, v in var.platform_landingzones : k => v if v.dev_enabled }
  project_id            = data.azuredevops_project.multispecies.id
  service_endpoint_name = "name-of-se-${each.value.lz_short_name}-dev"
  description           = "Managed by Terraform"
  credentials {
    serviceprincipalid  = azuread_service_principal.dev-spn[each.key].object_id
    serviceprincipalkey = azuread_service_principal_password.dev-spn-password[each.key].value
  }
  azurerm_spn_tenantid      = var.tenant_id
  azurerm_subscription_id   = azurerm_subscription.platform-SUBs-dev[each.key].subscription_id
  azurerm_subscription_name = azurerm_subscription.platform-SUBs-dev[each.key].subscription_name
}

Debug Output

Panic Output

	github.com/microsoft/terraform-provider-azuredevops/azuredevops/internal/service/serviceendpoint/commons.go:119 +0x151
github.com/microsoft/terraform-provider-azuredevops/azuredevops/internal/service/serviceendpoint.flattenServiceEndpointAzureRM(0xc0000123c0?, 0xc000525200, 0xc0000a8260?)
	github.com/microsoft/terraform-provider-azuredevops/azuredevops/internal/service/serviceendpoint/resource_serviceendpoint_azurerm.go:173 +0x27
github.com/microsoft/terraform-provider-azuredevops/azuredevops/internal/service/serviceendpoint.genServiceEndpointReadFunc.func1(0xc000150f00, {0x131b8c0?, 0xc000534140})
	github.com/microsoft/terraform-provider-azuredevops/azuredevops/internal/service/serviceendpoint/commons.go:233 +0x2ef
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).read(0x1610000?, {0x1610000?, 0xc0004e5f50?}, 0xd?, {0x131b8c0?, 0xc000534140?})
	github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/resource.go:712 +0x178
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).RefreshWithoutUpgrade(0xc0003e4540, {0x1610000, 0xc0004e5f50}, 0xc000052f70, {0x131b8c0, 0xc000534140})
	github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/resource.go:1015 +0x585
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).ReadResource(0xc0003a8a98, {0x1610000?, 0xc0004e5e30?}, 0xc000013280)
	github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/grpc_provider.go:613 +0x497
github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server.(*server).ReadResource(0xc00035d0e0, {0x1610000?, 0xc0004e5350?}, 0xc00007c7e0)
	github.com/hashicorp/[email protected]/tfprotov5/tf5server/server.go:748 +0x49e
github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_ReadResource_Handler({0x1478100?, 0xc00035d0e0}, {0x1610000, 0xc0004e5350}, 0xc00058a150, 0x0)
	github.com/hashicorp/[email protected]/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:349 +0x170
google.golang.org/grpc.(*Server).processUnaryRPC(0xc0001e61e0, {0x1612c60, 0xc000064ea0}, 0xc0000d9560, 0xc0004030e0, 0x1b3a6b0, 0x0)
	google.golang.org/[email protected]/server.go:1295 +0xb0b
google.golang.org/grpc.(*Server).handleStream(0xc0001e61e0, {0x1612c60, 0xc000064ea0}, 0xc0000d9560, 0x0)
	google.golang.org/[email protected]/server.go:1636 +0xa1b
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 +0x28a

Error: The terraform-provider-azuredevops_v0.5.0 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 Behavior
Plan should have provided number of service endpoints being created/destroyed
<!--- What should have happened? --->

### Actual Behavior
Terraform plan failed
<!--- What actually happened? --->

### Steps to Reproduce
<!--- Please list the steps required to reproduce the issue. --->
Create management group
Create subscription
Create SPN (azurerm provider)
Create SPN password (azurerm provider)
Create Service endpoint (Azure devops provider)..
  1. terraform plan

Important Factoids

We are using azure public cloud with backend in storage account. Same configuration was working fine, we have just refactored it to into multiple files and modules approach to call from a root file.

Plan is giving expected outcome about resources which will be destroyed and others which will be created but crashes and causes pipeline to fail.

References

  • #0000

sujitks avatar Jun 06 '23 12:06 sujitks