microsoft / azure-pipelines-terraform

Azure Pipelines tasks for installing Terraform and running Terraform commands in a build or release pipeline.
MIT License
107 stars 66 forks source link

Terraform CLI task ignores ENV variables. #238

Closed kivio closed 1 month ago

kivio commented 1 month ago

When I try to deliver ENV variables for terraform that are accepted only trough environment variables it looks like it was ignored:

- task: TerraformCLI@1
            name: terraformPlan
            displayName: Plan
            env:
              DYNATRACE_ENV_URL: "${{ variables.dtEnvUrl }}"
              DT_CLIENT_ID: "${{ variables.dtClientId }}"
              DT_ClIENT_ACCOUNT_ID: "${{ variables.dtAccountId }}"
              DYNATRACE_API_TOKEN: "${{ variables.dtApiToken }}"
              DT_CLIENT_SECRET: "${{ variables.dtClientSecret }}"
            inputs:
              workingDirectory: "$(System.DefaultWorkingDirectory)"
              command: "plan"
              commandOptions: "--out=main.tfplan -detailed-exitcode"
              environmentServiceName: "${{ variables.serviceConnectionName }}"
              publishPlanResults: "PlanView"

image

In this case, maybe it can be fixed using terraform provider attributes, as suggested in issue. However, CLIENT related parameters are not supported through terraform providers attributes, and only environment configuration will work.

mericstam commented 1 month ago

Hi, that task is not part of this extension.

Br, Manuel