jason-johnson / azure-pipelines-tasks-terraform

Azure Pipelines extension for Terraform
MIT License
127 stars 55 forks source link

Option runAzLogin ignored on init task #279

Open voroniys opened 2 years ago

voroniys commented 2 years ago

Describe the bug Option runAzLogin is ignored on init task

To Reproduce Create config like this one and execute:

    - task: TerraformCLI@0
      displayName: 'terraform init'
      inputs:
        command: init
        backendType: azurerm
        runAzLogin: false
        .....

Expected behavior With runAzLogin set to false expected to skip az login. But az login is executed anyway thus making impossible the workaround for #270

Pipeline Logs

/usr/bin/az login --service-principal -t db1e96a8-a3da-442a-930b-235cac24cd5c -u *** -p
ERROR: argument --password/-p: expected one argument

Examples from AI knowledge base:
az login --service-principal -u http://azure-cli-2016-08-05-14-31-15/ -p VerySecret --tenant contoso.onmicrosoft.com
Log in with a service principal using client secret. Use -p=secret if the first character of the password is '-'.

az login --service-principal -u http://azure-cli-2016-08-05-14-31-15/ -p ~/mycertfile.pem --tenant contoso.onmicrosoft.com
Log in with a service principal using client certificate.

az login -u johndoe@contoso.com -p VerySecret
Log in with user name and password. This doesn't work with Microsoft accounts or accounts that have two-factor authentication enabled. Use -p=secret if the first character of the password is '-'.

https://aka.ms/cli_ref
Read more about the command in reference docs
ncook-hxgn commented 2 years ago

I'm a fan of this issue and I'm glad this extension exists. I'd like to install this extension in a test org and see if it meets our needs (looks like it will, from the docs), but this issue seems like a blocker, as we live in azdo.