Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Azure DevOps Terraform Init - Remote State - Failed to get existing workspaces: containers.Client#ListBlobs: Failure sending request: StatusCode=0

Experiencing terraform for the very time, I'm following the document from this link to put in my terraform files in a release pipeline that I have with Azure DevOps. Everything runs perfectly fine until the step where it initializes the terraform. It fails with the following error message:

enter image description here

The storage account itself is provisioned and the key of that also is persisted successfully in the environment variables as per the document.

The YAML I have for terraform init in Azure DevOps Release pipeline is: enter image description here

And the terraform script for the backend service is: enter image description here

The variables are stored as environment variables inside the release pipeline and there is a replace token task that replaces __ with string empty: enter image description here

Her is the step in the pipeline that create the resource group and storage account: enter image description here

And finally, the PS scripts that store the storage key in the ENV vars: enter image description here

Also, I can't understand why the get http from the error message has env appended to the terraform.tformstate.

I'm running out of ideas why it fails with that exception and what is expecting actually.

I've been Googling around but have been failing so far to resolve the issue. Appreciate your help/thoughts on this.

like image 377
Ali Avatar asked Mar 01 '23 21:03

Ali


1 Answers

Looks like you misspelled storageaccount for your variable. So the value is not substituted. You have sotrageaccount. The t and o are swapped.

like image 141
Christian Pearce Avatar answered Apr 28 '23 12:04

Christian Pearce