semaphore icon indicating copy to clipboard operation
semaphore copied to clipboard

Semaphore + Terraform/OpenTofu with Azure CLI credentials

Open mlanner opened this issue 1 year ago • 1 comments

Discussed in https://github.com/semaphoreui/semaphore/discussions/2386

Originally posted by mlanner October 1, 2024 I have a Terraform/OpenTofu project for Azure that works just fine if run from the command line. The project uses Azure's CLI and specifically az login to consistently build the resources in Azure as defined in the main.tf code. I recently added this project to Semaphore and it all looks right (to me) and it successfully initializes the workspace when starting the task. However, as soon as it starts running the tofu plan it fails and says to run az login. I assume this is because Semaphore can't read the Azure CLI env variables? But, no matter if that assumption is right or wrong, I'd like to understand how I can make Semaphore execute my task. My goal is to use Semaphore to make this easier for other people on my team to stand up infrastructure without needing to know a lot about Terraform, using the command line, or even having CLI access to the server.

Any suggestions, ideas or insights into how to go about it would be greatly appreciated.

Thanks in advance!

mlanner avatar Oct 02 '24 16:10 mlanner

Follow up ... Having tried a few more things and also having had a colleague review it with me, I'm thinking this might be a bug. I'd be happy to be proven wrong on that, or just be told how to handle it, but for right now I can't make it work using Semaphore, while it is working just fine using tofu plan and/or tofu apply on the command line.

mlanner avatar Oct 02 '24 16:10 mlanner