microsoft / terraform-provider-azuredevops

Terraform Azure DevOps provider
https://www.terraform.io/docs/providers/azuredevops/
MIT License
387 stars 280 forks source link

azuredevops provider not behaving as expected. #744

Open imnitin28 opened 1 year ago

imnitin28 commented 1 year ago

Community Note

Terraform (and Azure DevOps Provider) Version

terraform version,

$ terraform version
Terraform v1.4.4
on linux_amd64
+ provider registry.terraform.io/hashicorp/azurerm v2.75.0
+ provider registry.terraform.io/microsoft/azuredevops v0.4.0

Affected Resource(s)

Terraform Configuration Files

terraform init is OK But when performing terraform plan it is not able to find provided azuredevops provider.

image

Actual Behavior

Failed to perform terraform plan

Steps to Reproduce

  1. terraform apply

Important Factoids

I have gone through these issues https://github.com/microsoft/terraform-provider-azuredevops/issues/652, but no luck for me.

davidcorrigan714 commented 1 year ago

I've seen this when the org_service_url is incorrect, accidentally copy+pasted one the other day that was some random other page in the system. 😆

xuzhang3 commented 1 year ago

@imnitin28 I cannot reproduce this error. Can you enable the log and apply again?

export TF_LOG=TRACE
export TF_LOG_PATH=<LOG_FILE_PATH>
imnitin28 commented 1 year ago

Hi @xuzhang3, This looked like some relatable info to be related to our issue. It looks like the provider is not responding correctly, and Terraform is unable to find the requested page. This causes Terraform to throw an error and skip over the affected resources. Please let me know if you need full output.

2023-04-07T22:52:55.104+0530 [TRACE] provider.terraform-provider-azuredevops_v0.4.0: Received downstream response: @caller=github.com/hashicorp/terraform-plugin-go@v0.14.0/tfprotov5/internal/tf5serverlogging/downstream_request.go:37 diagnostic_error_count=1 tf_provider_addr=registry.terraform.io/microsoft/azuredevops tf_req_duration_ms=387 tf_req_id=b3384d2d-82d1-fabd-86e1-c3453862339f @module=sdk.proto diagnostic_warning_count=0 tf_proto_version=5.3 tf_rpc=Configure timestamp=2023-04-07T22:52:55.104+0530
2023-04-07T22:52:55.104+0530 [ERROR] provider.terraform-provider-azuredevops_v0.4.0: Response contains error diagnostic: diagnostic_summary="Page not found." tf_req_id=b3384d2d-82d1-fabd-86e1-c3453862339f @caller=github.com/hashicorp/terraform-plugin-go@v0.14.0/tfprotov5/internal/diag/diagnostics.go:55 @module=sdk.proto diagnostic_severity=ERROR diagnostic_detail= tf_proto_version=5.3 tf_provider_addr=registry.terraform.io/microsoft/azuredevops tf_rpc=Configure timestamp=2023-04-07T22:52:55.104+0530
2023-04-07T22:52:55.104+0530 [TRACE] provider.terraform-provider-azuredevops_v0.4.0: Served request: @module=sdk.proto tf_provider_addr=registry.terraform.io/microsoft/azuredevops tf_req_id=b3384d2d-82d1-fabd-86e1-c3453862339f @caller=github.com/hashicorp/terraform-plugin-go@v0.14.0/tfprotov5/tf5server/server.go:567 tf_proto_version=5.3 tf_rpc=Configure timestamp=2023-04-07T22:52:55.104+0530
2023-04-07T22:52:55.104+0530 [ERROR] vertex "provider[\"registry.terraform.io/microsoft/azuredevops\"]" error: Page not found.
2023-04-07T22:52:55.104+0530 [TRACE] vertex "provider[\"registry.terraform.io/microsoft/azuredevops\"]": visit complete, with errors
2023-04-07T22:52:55.104+0530 [TRACE] dag/walk: upstream of "azuredevops_project.nm-az (expand)" errored, so skipping
2023-04-07T22:52:55.104+0530 [TRACE] dag/walk: upstream of "azuredevops_git_repository.nm-az (expand)" errored, so skipping
2023-04-07T22:52:55.104+0530 [TRACE] dag/walk: upstream of "azuredevops_variable_group.nm-az (expand)" errored, so skipping
2023-04-07T22:52:55.104+0530 [TRACE] dag/walk: upstream of "azuredevops_build_definition.nm-az (expand)" errored, so skipping
2023-04-07T22:52:55.104+0530 [TRACE] dag/walk: upstream of "provider[\"registry.terraform.io/microsoft/azuredevops\"] (close)" errored, so skipping
2023-04-07T22:52:56.361+0530 [INFO]  provider.terraform-provider-azurerm_v2.75.0_x5: authenticated object ID cache miss, populating with: "": timestamp=2023-04-07T22:52:56.361+0530
2023-04-07T22:52:56.361+0530 [INFO]  provider.terraform-provider-azurerm_v2.75.0_x5: Getting OAuth config for endpoint https://login.microsoftonline.com/ with  tenant 19808729-db27-4d6e-8315-1ba7d75db983: timestamp=2023-04-07T22:52:56.361+0530
2023-04-07T22:52:58.591+0530 [DEBUG] provider.terraform-provider-azurerm_v2.75.0_x5: Genereated Provider Correlation Request Id: 836c2db7-572c-afc7-49ee-01bf65cab3d2: timestamp=2023-04-07T22:52:58.591+0530
2023-04-07T22:52:58.998+0530 [DEBUG] provider.terraform-provider-azurerm_v2.75.0_x5: AzureRM Request: 
GET /subscriptions/b00e9e00-4924-464f-929d-7c28ccf1a449/providers?api-version=2016-02-01 HTTP/1.1
Host: management.azure.com
User-Agent: Go/go1.16.7 (amd64-linux) go-autorest/v14.2.1 Azure-SDK-For-Go/v57.0.0 resources/2016-02-01 HashiCorp Terraform/1.4.4 (+https://www.terraform.io) Terraform Plugin SDK/2.7.0 terraform-provider-azurerm/2.75.0 pid-222c6c49-1b0a-5959-a213-6608f9eb8820
X-Ms-Correlation-Request-Id: 836c2db7-572c-afc7-49ee-01bf65cab3d2
Accept-Encoding: gzip: timestamp=2023-04-07T22:52:58.998+0530
xuzhang3 commented 10 months ago

@imnitin28 this seems the ADO provider does not initialize correctly. Can you help verify the PAT, the easiest way is call a get API with PAT.