azure-pipelines-tasks-terraform
azure-pipelines-tasks-terraform copied to clipboard
Update to work as suggested in linked issue
> > Hi @jaredfholgate - yes I am passing it in as a CLI arg. To use an env var am I going to use these [secure-variable-secrets](https://marketplace.visualstudio.com/items?itemName=JasonBJohnson.azure-pipelines-tasks-terraform#secure-variable-secrets)? At the moment one of my pipeline steps gets the latest token value from Azure Key vault and then it's passed into the plan - how can I still get the value from key vault and then supply it as an environment variable for the terraform task?
Thanks for your reply btw! and apologies @Nullh - I missed your message, but yes, still not working at this point - but partly due to other priorities
Hi. I am referring to supplying via the env vars in the provider. I'm not sure the Jason Johnson task currently supports that. I added it to the DevLabs task if you can use that instead? https://marketplace.visualstudio.com/items?itemName=ms-devlabs.custom-terraform-tasks
It is the
Use Env Vars for Authenticationsetting. Set it to true like this: https://github.com/Azure-Samples/azure-devops-terraform-oidc-ci-cd/blob/5e352f715c8ad249ad0a69feff9aa2ff20095e05/pipelines/oidc.yml#L66If you are just using Azure CLI, then you can set the env vars directly like this: https://github.com/Azure/accelerator-bootstrap-modules/blob/e848f90815c32eabc7c7a22a0fa2ad6da507695b/alz/azuredevops/pipelines/terraform/templates/helpers/terraform-init.yaml#L30
To confirm, they are hard-coded as CLI args in the JJ task, so would require an update I think: https://github.com/jason-johnson/azure-pipelines-tasks-terraform/blob/756f2ba62a644865933be62c2f5f94cdd36a9e75/tasks/terraform-cli/src/backends/azurerm.ts#L78
@jason-johnson FYI
Originally posted by @jaredfholgate in https://github.com/hashicorp/terraform/issues/34322#issuecomment-2573178478
Additional info: https://github.com/hashicorp/terraform/issues/35361#issuecomment-2181321390