Terraform-provider-azuredevops: System.AccessToken

Created on 30 Dec 2020  路  2Comments  路  Source: microsoft/terraform-provider-azuredevops

Is it possible to log in through the system PAT? which is used in AzureDevops Pipelines? $(System.AccessToken)

question

Most helpful comment

Thanks. I use this extension (https://marketplace.visualstudio.com/items?itemName=charleszipp.azure-pipelines-tasks-terraform)
And there is no way to use environment variables. Solved the problem like this

- task: TerraformCLI@0
    displayName: Terraform plan
    inputs:
      command: plan
      workingDirectory: $(terraform_path)
      environmentServiceName: Main_${{ parameters.Subscription }}
      commandOptions: -out=terraform.tfplan -var-file="../../vars/Infrastructure.tfvars.json" -var azuredevops_project_id="$(System.TeamProjectId)" -var azuredevops_org_service_url="$(System.TeamFoundationCollectionUri)" -var azuredevops_personal_access_token="$(System.AccessToken)"

All 2 comments

Hi @y6vmeq You can use the $(System.AccessToken), make sure you export the PAT as the ENV variable
Example:

- bash: |
  displayName: 'Terraform'
  env:
      AZDO_PERSONAL_ACCESS_TOKEN: $(System.AccessToken)

Thanks. I use this extension (https://marketplace.visualstudio.com/items?itemName=charleszipp.azure-pipelines-tasks-terraform)
And there is no way to use environment variables. Solved the problem like this

- task: TerraformCLI@0
    displayName: Terraform plan
    inputs:
      command: plan
      workingDirectory: $(terraform_path)
      environmentServiceName: Main_${{ parameters.Subscription }}
      commandOptions: -out=terraform.tfplan -var-file="../../vars/Infrastructure.tfvars.json" -var azuredevops_project_id="$(System.TeamProjectId)" -var azuredevops_org_service_url="$(System.TeamFoundationCollectionUri)" -var azuredevops_personal_access_token="$(System.AccessToken)"
Was this page helpful?
0 / 5 - 0 ratings