So I am aware of a couple Azure DevOps terraform tasks. But we wrap our terraform calls with powershell scripts, so these tasks are of no use to us.
So, given that we call terraform from scripts the only way we could find to make terraform authenticate is by following this procedure:
- Create Service Connection using the Service Principal dedicated to the pod
- Create a variable group and link it to the Key Vault containing the SP credentials.
- Every task running the powershell code wrapping terraform would have environment variables
ARM_CLIENT_IDandARM_CLIENT_SECRETmapped to the variables in the variable group from (2).ARM_TENANT_IDandARM_SUBSCRIPTION_IDare set accordingly.
But this is incredibly cumbersome. Is it possible to do it with just the Service Connection?