microsoft / terraform-provider-azuredevops

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

argument org_service_url does not work in provider config #239

Open poligraph opened 4 years ago

poligraph commented 4 years ago

Community Note

Terraform (and Azure DevOps Provider) Version

terraform -v Terraform v0.13.5

Affected Resource(s)

Terraform Configuration Files

per-project config like this

provider "azuredevops" {
  version         = "= 0.1.0"
  org_service_url = "https://dev.azure.com/MY-ORG/"
}

global config like this

terraform {
  required_version = ">= 0.13"
  required_providers {
    azuredevops = {
      source  = "microsoft/azuredevops"
      version = ">=0.1.0"
}

Debug Output

Panic Output

Expected Behavior

plan should work

Actual Behavior

Error: the url of the Azure DevOps is required

  on <empty> line 0:
  (source code not available)

Steps to Reproduce

  1. unset AZDO_ORG_SERVICE_URL
  2. terraform plan

Important Factoids

if I set ENV variable - plan works good, but without it - it does not work. I worked with provider version 0.0.1

References

xuzhang3 commented 4 years ago

@poligraph The pre-config still needed here if you set org_url and persona_access_token in the TF script.

terraform {
  required_version = ">= 0.13"
  required_providers {
    azuredevops = {
      source = "microsoft/azuredevops"
      version = ">=0.1.0"
    }
  }
}

provider "azuredevops" {
  org_service_url       = "https://dev.azure.com/MY-ORG/"
  personal_access_token = ""
}
poligraph commented 4 years ago

@xuachen I use token env variable AZDO_PERSONAL_ACCESS_TOKEN as before with 0.0.1 provider and org_service_url in config. But with 0.1.0 this combination does not work - I need to provide AZDO_ORG_SERVICE_URL in ENV, what is not convenient to use.

xuzhang3 commented 4 years ago

@poligraph Your configuration should work for v0.1.0. For ADO provider, ENV configure AZDO_ORG_SERVICE_URL and provider config org_service_url are the same configuration. Can you check whether the personal access token point to the organization you use? I test different configuration combination, all worked for me.

poligraph commented 4 years ago

@xuzhang3 so here is my config

provider "azuredevops" {
  version         = "~> 0.1.0"
  org_service_url = "https://dev.azure.com/MY-ORG/"
  # personal_access_token = ""```

```env | grep AZDO
AZDO_ORG_SERVICE_URL=https://dev.azure.com/MY-ORG/
AZDO_PERSONAL_ACCESS_TOKEN=MY_TOKEN

terraform plan work with no issues

but after I do unset AZDO_ORG_SERVICE_URL

it works fine :), let me do some research, I will not able to reproduce - I will close issues.