Skip to content

azure: Error: Error building ARM Config: obtain subscription() from Azure CLI #1944

Open
@abazzi-neogenomics

Description

@abazzi-neogenomics

Hi guys, I'm here again \o/

I'm trying out digger on github runners, to deploy azure resources this time 😆
I'm using client_secret auth and this is the error i see

Initializing the backend...
Upgrading modules...
<cut>
Error: Error building ARM Config: obtain subscription() from Azure CLI: parsing json result from the Azure CLI: waiting for the Azure CLI: exit status 1: ERROR: Please run 'az login' to setup account.


Error: exit status 1
Failed to Run digger plan command. error running init: exit status 1
Failed to run commands. error while running command: Failed to Run digger plan command. error running init: exit status 1
Error: Process completed with exit code 8.

It appears that Azure cli wants the sub id, but i cannot find a way to pass it.

This is the workflow:

<cut>
        - name: digger run
          uses: diggerhq/digger@v0.3.27. # old version i was using, see next comment for newer version
          with:
            no-backend: true
            setup-terraform: true
            setup-azure: true
            terraform-version: ${{ inputs.TF_VERSION }}
          env:
            GITHUB_CONTEXT: ${{ toJson(github) }}
            GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 
            GITHUB_OWNER: xxx
            LOCK_PROVIDER: azure
            DIGGER_AZURE_AUTH_METHOD: CLIENT_SECRET
            DIGGER_AZURE_CLIENT_ID: ${{ secrets.ARM_CLIENT_ID_SANDBOX }}
            DIGGER_AZURE_CLIENT_SECRET: ${{ secrets.ARM_CLIENT_SECRET_SANDBOX}}
            DIGGER_AZURE_TENANT_ID: ${{ secrets.ARM_TENANT_ID }}
            DIGGER_AZURE_SA_NAME: "stmysotrageaccounttfstate"
          

(i redacted some stuff but you get the idea)

I tried passing to the workflow file ARM_SUBSCRIPTION_ID: ${{ secrets.ARM_SUBSCRIPTION_ID_SANDBOX }} but no luck.
I also tried adding it in the workflow configuration digger.yml like this

---
projects:

- name: sandbox
  dir: ./sandbox/
  workflow: sandbox
  terraform_plan_args: "-var-file=terraform.tfvars"
  terraform_apply_args: "-var-file=terraform.tfvars"


workflows:

  sandbox:
    env_vars:
      commands:
        - name: ARM_SUBSCRIPTION_ID
          value: ${{ secrets.ARM_SUBSCRIPTION_ID_SANDBOX }}

also no luck.

am i missing something? Is there another way to pass env vars?

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions