microsoft / azure-pipelines-terraform

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

Allow setting environment variables #193

Closed hbuckle closed 8 months ago

hbuckle commented 8 months ago

It is useful to be able to set environment variables, for example to configure other providers than azure/aws/gcp

theo-albers commented 8 months ago

That might also help #189 when it respects ARM_* environment variables as hints. When these are set:

ARM_TENANT_ID
ARM_SUBSCRIPTION_ID
ARM_CLIENT_ID 
ARM_CLIENT_SECRET

don't override them in the task?

mericstam commented 8 months ago

Looks good. This setting is only valid for classic pipelines. it has always been possible in YAML pipelines. Example:

task.TerraformTaskV4@4
  displayName: 'Terraform : azurerm'
  inputs:
    backendServiceArm: spMSDN
    backendAzureRmResourceGroupName: terraform
    backendAzureRmStorageAccountName: solstatestore2
    backendAzureRmContainerName: state
    backendAzureRmKey: state.tfstate
  env:
    TF_WORKSPACE: test

Br, Manuel