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

Provider returns misleading error when organization service URL is incorrect #789

Closed
msl0 opened this issue Jun 9, 2023 · 5 comments
Closed
Labels

Comments

@msl0
Copy link

msl0 commented Jun 9, 2023

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 v1.4.5
on linux_amd64
provider registry.terraform.io/microsoft/azuredevops v0.5.0

Affected Resource(s)

  • azuredevops_*

Terraform Configuration Files

terraform {
  required_providers {
    azuredevops = {
      source  = "microsoft/azuredevops"
      version = ">=0.2.0"
    }
  }
}

provider "azuredevops" {
  org_service_url = "https://dev.azure.com/dummy-org"   
  personal_access_token = "correct-pat" 
}

data "azuredevops_project" "test" {
    name = "Test"
}

Debug Output

Panic Output

Expected Behavior

It would be good to see information that there is a problem with URL or organization name when problem occur. The current error message is misleading.

╷
│ Error: The organization "dummy-org" does not exist.
│ 
│   with provider["registry.terraform.io/microsoft/azuredevops"],
│   on main.tf line 1, in provider "azuredevops":
│    1: provider "azuredevops" {
│ 

Actual Behavior

Provider returns misleading error when organization service URL is incorrect.

Planning failed. Terraform encountered an error while generating this plan.

╷
│ Error: The resource cannot be found.
│ 
│   with provider["registry.terraform.io/microsoft/azuredevops"],
│   on main.tf line 1, in provider "azuredevops":
│    1: provider "azuredevops" {
│ 
╵

Steps to Reproduce

  1. terraform init
  2. terraform apply

Important Factoids

References

@xuzhang3
Copy link
Collaborator

@msl0 If URL/PAT not correct, an 401 Unauthorized. This is more like an initialization error, the provider not initialized.

@msl0
Copy link
Author

msl0 commented Jun 29, 2023

I don't quite understand what you mean. I got the mentioned error, not 401 Unauthorized. When I corrected URL it started working. What I noticed is an error that does not indicate the cause

@xuzhang3
Copy link
Collaborator

xuzhang3 commented Jul 3, 2023

@msl0 What permission does you PAT granted, full permission or custom permissions?

@xuzhang3 xuzhang3 mentioned this issue Oct 30, 2024
11 tasks
@msl0
Copy link
Author

msl0 commented Nov 5, 2024

I don't remember, but I know that with the correct address the problem didn't occur

@xuzhang3
Copy link
Collaborator

xuzhang3 commented Nov 6, 2024

I added a custom error message in #1207 which should help

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

No branches or pull requests

2 participants